diff options
author | Tatsuyuki Ishi <ishitatsuyuki@gmail.com> | 2023-10-16 14:04:12 +0900 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-11-09 14:03:18 +0100 |
commit | 1c6d6b34b112b52566ebde49afef3e6eb747ef90 (patch) | |
tree | bd228d76f89fed4e2fdb7e45159163ffa49e5f66 | |
parent | fd8e5f3c430f37c99ddcc00fcafc1a12b3475a3a (diff) | |
download | gcc-1c6d6b34b112b52566ebde49afef3e6eb747ef90.zip gcc-1c6d6b34b112b52566ebde49afef3e6eb747ef90.tar.gz gcc-1c6d6b34b112b52566ebde49afef3e6eb747ef90.tar.bz2 |
Do not prepend target triple to -fuse-ld=lld,mold.
lld and mold are platform-agnostic and not prefixed with target triple.
Prepending the target triple makes it less likely to find the intended
linker executable.
A potential breaking change is that we no longer try to search for
triple-prefixed lld/mold binaries anymore. However, since there doesn't
seem to be support to build LLVM or mold with triple-prefixed executable
names, it seems better to just not bother with that case.
PR driver/111605
* collect2.cc (main): Do not prepend target triple to
-fuse-ld=lld,mold.
-rw-r--r-- | gcc/collect2.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/collect2.cc b/gcc/collect2.cc index 63b9a0c..c943f9f 100644 --- a/gcc/collect2.cc +++ b/gcc/collect2.cc @@ -865,12 +865,15 @@ main (int argc, char **argv) int i; for (i = 0; i < USE_LD_MAX; i++) - full_ld_suffixes[i] #ifdef CROSS_DIRECTORY_STRUCTURE - = concat (target_machine, "-", ld_suffixes[i], NULL); -#else - = ld_suffixes[i]; -#endif + /* lld and mold are platform-agnostic and not prefixed with target + triple. */ + if (!(i == USE_LLD_LD || i == USE_MOLD_LD)) + full_ld_suffixes[i] = concat (target_machine, "-", ld_suffixes[i], + NULL); + else +#endif + full_ld_suffixes[i] = ld_suffixes[i]; p = argv[0] + strlen (argv[0]); while (p != argv[0] && !IS_DIR_SEPARATOR (p[-1])) |