summaryrefslogtreecommitdiff
path: root/tools/llvm-lto
diff options
context:
space:
mode:
authorTom Roeder <tmroeder@google.com>2014-04-25 21:46:51 +0000
committerTom Roeder <tmroeder@google.com>2014-04-25 21:46:51 +0000
commit817f5e2fa137b15b536c952bcc1e75b1dd34b4b1 (patch)
treef514566a78e689fcc0c138b83fde6342a4c26c9a /tools/llvm-lto
parentc744a371534456c1bb6557f053705f066ac33b62 (diff)
downloadllvm-817f5e2fa137b15b536c952bcc1e75b1dd34b4b1.tar.gz
llvm-817f5e2fa137b15b536c952bcc1e75b1dd34b4b1.tar.bz2
llvm-817f5e2fa137b15b536c952bcc1e75b1dd34b4b1.tar.xz
Add an -mattr option to the gold plugin to support subtarget features in LTO
This adds support for an -mattr option to the gold plugin and to llvm-lto. This allows the caller to specify details of the subtarget architecture, like +aes, or +ssse3 on x86. Note that this requires a change to the include/llvm-c/lto.h interface: it adds a function lto_codegen_set_attr and it increments the version of the interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207279 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-lto')
-rw-r--r--tools/llvm-lto/llvm-lto.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/llvm-lto/llvm-lto.cpp b/tools/llvm-lto/llvm-lto.cpp
index 1a92bf4f0e..678e4db08f 100644
--- a/tools/llvm-lto/llvm-lto.cpp
+++ b/tools/llvm-lto/llvm-lto.cpp
@@ -143,6 +143,16 @@ int main(int argc, char **argv) {
for (unsigned i = 0; i < KeptDSOSyms.size(); ++i)
CodeGen.addMustPreserveSymbol(KeptDSOSyms[i].c_str());
+ std::string attrs;
+ for (unsigned i = 0; i < MAttrs.size(); ++i) {
+ if (i > 0)
+ attrs.append(",");
+ attrs.append(MAttrs[i]);
+ }
+
+ if (!attrs.empty())
+ CodeGen.setAttr(attrs.c_str());
+
if (!OutputFilename.empty()) {
size_t len = 0;
std::string ErrorInfo;