[clang] [Clang][Solaris] Support --ld-path in Solaris driver (PR #163000)

Daniel Levin via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 21 04:26:40 PST 2025


daniel-levin wrote:

> It used to be possible to set CLANG_DEFAULT_LINKER to e.g. gld. This doesn't work any longer.
> That said, the patch introduces quite a number of regressions

There are two, by my count, and they are both "regressions" in the sense that the tests erroneously pass when `gld` is supplied as `CLANG_DEFAULT_LINKER`, not as an environment variable, but rather a CMake variable.

Indeed, if you `cmake ... _DCLANG_DEFAULT_LINKER=gld` and run the supposedly failing test cases, you'll see this:


```
# | Input file: <stdin>
# | Check file: /home/omnios/llvm-project/clang/test/Driver/solaris-ld-sanitizer.c
# |
# | -dump-input=help explains the following input dump.
# |
# | Input was:
# | <<<<<<
# |             1: clang version 22.0.0git (git at github.com:daniel-levin/llvm-project.git 602674e7046b54eed83a9e1421e6366d905e9031)
# | check:50'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |             2: Target: x86_64-pc-solaris2.11
# | check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             3: Thread model: posix
# | check:50'0     ~~~~~~~~~~~~~~~~~~~~
# |             4: InstalledDir: /home/omnios/llvm-project/build/bin
# | check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             5:  "/home/omnios/llvm-project/build/bin/clang-22" "-cc1" "-triple" "x86_64-pc-solaris2.11" "-emit-obj" "-dumpdir" "a-" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "solaris-ld-sanitizer.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-ffp-contr
act=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=/home/omnios/llvm-project/build/tools/clang/test/Driver" "-fcoverage-compilation-dir=/home/omnios/llvm-project/build/tools/clang/test/Driver" "-resource-dir" "/home/omnios/llvm-projec
t/build/lib/clang/22" "-isysroot" "/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree" "-internal-isystem" "/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree/usr/local/include" "-internal-isystem" "/home/omnios/llvm-project/build/lib/clang/22/include" "-internal-externc-isystem" "/home/omnios/llvm-project/clang/t
est/Driver/Inputs/solaris_x86_tree/usr/include" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-fsanitize=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unr
eachable,vla-bound" "-fsanitize-recover=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,pointer-overflow,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound" "-fsanitize-merge=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,i
nteger-divide-by-zero,nonnull-attribute,null,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound" "-fno-sanitize-memory-param-retval" "-fno-sanitize-address-use-odr-indicator" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "/tmp/lit-tmp-o3eluag5/solaris-ld-sanitizer-9f6b6d.o"
"-x" "c" "/home/omnios/llvm-project/clang/test/Driver/solaris-ld-sanitizer.c"
# | check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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"-e" "_start" "-m" "elf_x86_64_sol2" "--eh-frame-hdr" "-o" "a.out" "/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64/crt1.o" "/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64/crti.o" "values-Xa.o" "values-xpg6.o" "/home/omnios/llvm-project/clang/test/Driver
/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64/crtbegin.o" "-L/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64" "-L/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/../../../amd64" "-L
/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64" "--whole-archive" "/home/omnios/llvm-project/build/lib/clang/22/lib/x86_64-pc-solaris2.11/libclang_rt.ubsan_standalone.a" "--no-whole-archive" "--export-dynamic" "/tmp/lit-tmp-o3eluag5/solaris-ld-sanitizer-9f6b6d.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "
-lc" "--no-as-needed" "-lpthread" "-lrt" "-lm" "-ldl" "/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64/crtend.o" "/home/omnios/llvm-project/clang/test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64/crtn.o"
# | check:50'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```


That is, a "failing" test case in which clang is clearly doing the correct thing, i.e. respecting your build-time selection.

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


More information about the cfe-commits mailing list