[PATCH] lld: handling of -flavor / -core command line switches

Rui Ueyama ruiu at google.com
Fri Sep 19 17:13:37 PDT 2014


Oleg,

Please run clang-format and upload it again, so that I can bless it.

On Fri, Sep 19, 2014 at 5:09 PM, Nick Kledzik <kledzik at apple.com> wrote:

>
> On Sep 19, 2014, at 4:42 PM, Rui Ueyama <ruiu at google.com> wrote:
>
> My thought on the order that I presented is that: argv[0] is a way to make
> a deliberate choice on the flavor, and if it's the same name as a known
> linker, it should behave as a drop-in replacement of the linker. Because
> the simulating linker is unlikely to have -flavor option, it felt wrong to
> recognize that.
>
> However, I see the benefit of accepting -flavor whatever argv[0] is.
>
> So I'm OK with your patch if there's no objection from other LLD engineers.
>
> I’m Ok with it, since it won’t effect Darwin.
>
> Darwin does use use triples or triple-encoded-tool-names.  All tools are
> universal and select the target mode based on the -arch argument.
>
> If someone does try to use -flavor on darwin, it would be to do gnu style
> linking. In which case, 3 should take precedence.
>
> -Nick
>
>
>
> On Fri, Sep 19, 2014 at 10:37 AM, Oleg Ranevskyy <llvm.mail.list at gmail.com
> > wrote:
>
>> >>! In D5384#16, @ruiu wrote:
>> > However the current evaluation order doesn't seem correct. I think it
>> make a decision on the flavor in this order.
>> >
>> > 1. If argv[0] is "ld", the default linker driver is chosen
>> > 2. If argv[0] can be interpreted as a triple, the triple is chosen
>> > 3. otherwise, look for -flavor (and probably argv[0] is "lld" in this
>> case)
>> >
>> > Currently 3 takes precedence over 2, which I feel wrong.
>>
>> My patch makes the order even more different from that: 3 -> 1 -> 2.
>>
>> Let me explain my thoughts. If the user explicitly expresses his
>> intentions by providing some command line arguments, it is quite confusing
>> if these explicit settings get silently overridden by lld, making the
>> linker behave differently from what the user wants. Dependence of this
>> logic on the program name, which might be symlinked or even renamed, makes
>> this even more confusing. That's why -flavor's being of the highest
>> priority could make sense.
>>
>> Please feel free to correct me if this is not a good idea. I'll adjust
>> the code according to your recommendations then.
>>
>> Thank you.
>>
>> http://reviews.llvm.org/D5384
>>
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140919/6f9bd7aa/attachment.html>


More information about the llvm-commits mailing list