[PATCH] D16056: [Gold] Pass -mllvm options to the gold plugin
James Molloy via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 11 03:47:44 PST 2016
jmolloy created this revision.
jmolloy added a reviewer: rafael.
jmolloy added a subscriber: cfe-commits.
jmolloy set the repository for this revision to rL LLVM.
Herald added a subscriber: joker.eph.
The gold plugin can take LLVM options, but the syntax is confusing: -Wl,-plugin-opt= or -Xlinker -plugin-opt=.
Instead, pass -mllvm options through to Gold so the obvious syntax works.
Repository:
rL LLVM
http://reviews.llvm.org/D16056
Files:
lib/Driver/Tools.cpp
test/Driver/gold-lto.c
Index: test/Driver/gold-lto.c
===================================================================
--- test/Driver/gold-lto.c
+++ test/Driver/gold-lto.c
@@ -16,11 +16,14 @@
// CHECK-X86-64-COREI7: "-plugin-opt=foo"
//
// RUN: %clang -target arm-unknown-linux -### %t.o -flto 2>&1 \
-// RUN: -march=armv7a -Wl,-plugin-opt=foo -O0 \
+// RUN: -march=armv7a -Wl,-plugin-opt=foo -O0 -mllvm -bar=baz \
+// RUN: -mllvm -test-option \
// RUN: | FileCheck %s --check-prefix=CHECK-ARM-V7A
// CHECK-ARM-V7A: "-plugin" "{{.*}}/LLVMgold.so"
// CHECK-ARM-V7A: "-plugin-opt=mcpu=cortex-a8"
// CHECK-ARM-V7A: "-plugin-opt=O0"
+// CHECK-ARM-V7A: "-plugin-opt=-bar=baz"
+// CHECK-ARM-V7A: "-plugin-opt=-test-option"
// CHECK-ARM-V7A: "-plugin-opt=foo"
//
// RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1817,6 +1817,12 @@
if (IsThinLTO)
CmdArgs.push_back("-plugin-opt=thinlto");
+
+ // Claim and pass through -mllvm options to the Gold plugin.
+ for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
+ A->claim();
+ CmdArgs.push_back(Args.MakeArgString(Twine("-plugin-opt=") + A->getValue(0)));
+ }
}
/// This is a helper function for validating the optional refinement step
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16056.44461.patch
Type: text/x-patch
Size: 1375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160111/a090953c/attachment.bin>
More information about the cfe-commits
mailing list