[PATCH] D51440: [ToolChains] Link to compiler-rt with -L + -l when possible

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 5 16:37:53 PDT 2018


dexonsmith added a comment.

In https://reviews.llvm.org/D51440#1225318, @steven_wu wrote:

> I do prefer the current approach especially on Darwin. Some concerns of switching to use "-L + -l" are:
>
> 1. clang and compiler-rt are rev-locked. Inferring the compiler-rt from resource-dir and passing to linker with the full path can prevent mistakes of mixing them up.
> 2. This change does change linker semantics on Darwin. ld64 treats the inputs from command line with highest priority. Currently ld64 will use compiler-rt symbols before any other libraries passed in with -l flag. If clang decide to pass compiler-rt with -l flag, any other libraries (static or dynamic) that passed with -l flag will takes the priority over compiler-rt. This can lead to unexpected behavior.


I tend to agree with Steven.  I'd rather avoid a semantic change here.


Repository:
  rC Clang

https://reviews.llvm.org/D51440





More information about the cfe-commits mailing list