[clang] [Clang][Solaris] Support --ld-path in Solaris driver (PR #163000)
Rainer Orth via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 21 05:02:51 PST 2025
rorth wrote:
> Ah, the "regression" indeed enforces the presence of the bug!
>
> Consider the [code](https://github.com/llvm/llvm-project/blob/622f72f4bef8b177e1e4f318465260fbdb7711ef/clang/test/Driver/solaris-ld-sanitizer.c#L50) of the failing test:
>
> ```
> /// Check i386-pc-solaris2.11, 64bit
> // RUN: %clang -m64 -fsanitize=undefined --target=i386-pc-solaris2.11 %s -### -fuse-ld= \
> // RUN: --sysroot=%S/Inputs/solaris_x86_tree 2>&1 \
> // RUN: | FileCheck --check-prefix=CHECK-LD-X64-UBSAN %s
> // RUN: %clang -m64 -fsanitize=undefined --target=i386-pc-solaris2.11 %s -### -fuse-ld=gld \
> // RUN: --sysroot=%S/Inputs/solaris_x86_tree 2>&1 \
> // RUN: | FileCheck --check-prefix=CHECK-GLD-X64-UBSAN %s
>
> // CHECK-LD-X64-UBSAN: "-z" "relax=transtls"
> // CHECK-GLD-X64-UBSAN-NOT: "-z" "relax=transtls"
> ```
>
> It checks that `-z relax=transtls` is passed to the linker. This flag should only be passed to Solaris ld. If you build with CLANG_DEFAULT_LINKER as `bfd` or `gld`, this test cannot possibly be correct.
That's not what the test does: with `-fuse-ld=`, `/usr/bin/ld` is invoked and and `-z relax=transtls` should be passed as checked using the `CHECK-LD-X64-UBSAN ` label.
OTOH with `-fuse-ld=gld` the `CHECK-GLD-X64-UBSAN` label is used instead, but `CHECK-GLD-X64-UBSAN-NOT` checks that `z relax=transtls` is **not** present.
Again, in my test with `-DCLANG_DEFAULT_LINKER=gld` on unmodified `main` that test did indeed `PASS`.
https://github.com/llvm/llvm-project/pull/163000
More information about the cfe-commits
mailing list