| Issue |
202963
|
| Summary |
Making fuse-ld=lld work for --target=x86_64-pc-solaris2.11
|
| Labels |
lld
|
| Assignees |
|
| Reporter |
am11
|
We have illumos sysroot created with:
```sh
$ curl -sSL https://github.com/dotnet/arcade/raw/0a80b03/eng/common/cross/build-rootfs.sh | \
bash -s -- illumos x64 --rootfsdir /tmp/crossrootfs/x64
```
It installs host: linux-x64, target: illumos-x64 cross gcc toolchain at rootfsdir. From there, we use gcc toolchain to compiler code; it uses solaris linker.
If we try using host machine's `lld`, it runs into a few (workaroundable) errors.
Repro, fuse-ld=lld is instantly rejected:
```sh
$ ROOTFS_DIR=/tmp/crossrootfs/x64
$ clang-21 --target=x86_64-pc-solaris2.11 --sysroot=$ROOTFS_DIR \
--gcc-install-dir=$ROOTFS_DIR/lib/gcc/x86_64-sun-solaris2.10/8.4.0 -fuse-ld=lld -xassembler - <<EOF
.intel_syntax noprefix
test byte ptr [rdi], 0x8
.global main
main:
ret
EOF
clang-21: error: invalid linker name in argument '-fuse-ld=lld'
```
To circumvent it, I created a wrapper script to invoke ld.lld instead, it doesn't like `-C` passed by the driver:
```sh
#!/bin/sh
eval exec ld.lld $@
```
`chmod +x linker-wrapper.sh`
and used `-fuse-ld=$(pwd)/linker-wrapper.sh`:
```sh
$ clang-21 --target=x86_64-pc-solaris2.11 --sysroot=$ROOTFS_DIR \
--gcc-install-dir=$ROOTFS_DIR/lib/gcc/x86_64-sun-solaris2.10/8.4.0 -fuse-ld=$(pwd)/linker-wrapper.sh -xassembler - <<EOF
.intel_syntax noprefix
test byte ptr [rdi], 0x8
.global main
main:
ret
EOF
ld.lld: error: unknown argument '-C'
ld.lld: warning: unknown -z value: ignore
ld.lld: warning: unknown -z value: record
clang-21: error: linker command failed with exit code 1 (use -v to see invocation)
```
Then I modified the script:
```sh
#!/bin/sh
args=""
for a in "$@"; do
[ "$a" = "-C" ] && continue
# illumos sysroot currently ships libssp but not libssp_nonshared.
[ "$a" = "-lssp_nonshared" ] && a="-lssp"
args="$args \"$a\""
done
eval exec ld.lld $args
```
The current workaround addresses the immediate failure, but `-fuse-ld=lld` should work natively without requiring a wrapper script or manual argument filtering.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs