[clang] [clang][Driver] Obey -fuse-ld=... for -print-prog-name=ld output (PR #66698)

Roland McGrath via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 18 14:36:32 PDT 2023


frobtech wrote:

> I think the 2013 GCC feature adding -fuse-ld= made this change, which is, frankly, strange. I wish that we don't this...

It's too late now. Build system code in the wild uses `$CC -print-prog-name=ld` and then expects to be able to invoke that program to get the linker that `$CC` usually uses.  When `CC=gcc -fuse-ld=foo` that works, but when `CC=clang` it doesn't, whether there's a `-fuse-ld=...` in there or just the default in the toolchain configuration is something other than `ld`, such as when `ld.lld` is the default.
 
> lld has several names. For windows-msvc target triples it is `lld-link`, and for wasm triples it is wasm-ld.

ISTM that GetLinkerPath ought to produce the right name regardless and if it doesn't we can fix it to do so.


https://github.com/llvm/llvm-project/pull/66698


More information about the cfe-commits mailing list