[PATCH] D16056: [Gold] Pass -mllvm options to the gold plugin
Mehdi Amini via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 11 16:52:59 PST 2016
I’d fear the same thing. On our platform you have to use explicitly -Wl,-mllvm (or -Xlinker -plugin-opt).
—
Mehdi
> On Jan 11, 2016, at 4:11 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
>
> Maybe. I would like a second opinion on this one. The potential issue
> I see is that we are using compiler options during linking. Normally
> they are just ignored. Is it surprising if LTO starts using them?
>
> Cheers,
> Rafael
>
>
> On 11 January 2016 at 06:47, James Molloy <james.molloy at arm.com> wrote:
>> 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
>>
>>
More information about the cfe-commits
mailing list