[PATCH] D56650: [lld] [ELF] Support customizing behavior on target triple

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 1 22:28:35 PDT 2019


MaskRay requested changes to this revision.
MaskRay added a comment.

> krytarowski: The discussion is ongoing since 2017 and we have an impasse.
> 
>> peter.smith: I think this might be better raised on lllvm-dev as I suspect that we need to give this wider visibility. I'm not totally opposed to this as I can see that --target has some advantages over adding extra emulations, or relying on the --target in the compiler driver but I think we need to be careful to define how this will interact with the emulation, and what the bounds of what we can customise with the option are?

Peter suggested raising your problem on the llvm-dev mailing list. Have you done that?

Personally I am opposed to this change. The compiler driver (gcc,clang) has a set of arch/OS dependent defaults. It seems weird/redundant to add another sets of defaults on the linker side.

A few replies to some bullet points you raised in a previous comment.

> GCC to pass lld flags

Compiler drivers have more information (OS version, toolchain path, linker name, etc) to decide if some linker flags are needed. Some `-f` options can generate linker options as well.

> rpath behavior

>From my reading of https://blog.netbsd.org/tnf/entry/the_first_report_on_lld , I don't see why NetBSD must maintain the --disable-new-dtags local patch.

> GNU stack generation

`-z nognustack` makes sense to me. I commented on D56554 <https://reviews.llvm.org/D56554>.

> specify default target/emulation search paths

This job should be done in the compiler drivers.

> disable 3 segments

Personally I don't think it is really necessary to change the default.. But you can add --no-rosegment if you are really bothered by the layout.

I think your requirement can be simply accomplished with a shell script wrapper called `ld`:

  #!/bin/sh
  # customization
  exec ld.lld <options>


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56650/new/

https://reviews.llvm.org/D56650





More information about the cfe-commits mailing list