[PATCH] D151188: [lld] Find resource and lib dir

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 13:21:26 PDT 2023


MaskRay added a comment.

In D151188#4365722 <https://reviews.llvm.org/D151188#4365722>, @mstorsjo wrote:

> In D151188#4365673 <https://reviews.llvm.org/D151188#4365673>, @MaskRay wrote:
>
>> Adding default library paths to the linker seems odd. The convention is to add the code to Clang Driver.
>
> The issue with lld-link is that in MSVC environments, the convention is to invoke `link` or `lld-link` directly without going through `cl` or `clang-cl`. That's what makes things problematic here, and this is one potential path forward.
>
>> ld.lld (and likely gold) doesn't add any default library path and it has been working fine.
>> GNU ld may add some paths like `/usr/lib` that's already been added by gcc/clang drivers.
>
> FWIW, IIRC there was a discussion a couple years ago, where iirc NetBSD wanted ld.lld to use some default paths to make it a better drop-in replacement for the GNU linker.

Yes, and NetBSD's proposal was NAKed. Many people can feel that that kind of custom code doesn't belong to the upstream C++ code.
It doesn't scale if every ELF OS having different ideas about default library paths wants to add custom code to lld...
Actually, it's fairly easy to use a shell script wrapper instead of C++ code to do the same thing.

I know that Apple and Windows platforms are quite different and their linkers have some (unfortunate) designs that hard code quite a bit about the operating-system or environment specific information into linker options... I usually only comment when I find something too odd..


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151188



More information about the llvm-commits mailing list