[PATCH] D16056: [Gold] Pass -mllvm options to the gold plugin

James Molloy via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 11 23:26:37 PST 2016


Ok, I'll abandon this.

It wasn't meant to be contentious and this is a reasonable objection!

James



> On 12 Jan 2016, at 00:53, Mehdi Amini <mehdi.amini at apple.com> wrote:
>
> 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
>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.



More information about the cfe-commits mailing list