[clang] [llvm] [clang][sycl][nvlink] Share static library linking in Frontend/Offloading (PR #201253)

Alexey Bader via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 8 08:37:20 PDT 2026


bader wrote:

@jhuber6, I see that `clang-nvlink-wrapper` doesn't support `-z` option (see https://github.com/llvm/llvm-project/blob/main/clang/tools/clang-nvlink-wrapper/NVLinkOpts.td). `-z,relro` is misparsed into `relro` input file, which was ignored before my change (technically ignoring `-z,relro` option).

I see a few options to address this issue:
1. Add `-z` support to handle `relro` and other values correctly.
2. Restore original behavior.
3. Remove linker options `clang-nvlink-wrapper` doesn't support from `libompdevice` build scripts.

Here are options passed after `-Wl,-z,relro`: 
`-Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now --config=/usr/lib/rpm/redhat/redhat-hardened-clang-ld.cfg   -Wl,--build-id=sha1    -Wl,--build-id=sha1`

I suppose (1) is preferable, but I can't guarantee that `-z` is the only blocker for building libompdevice library.

In addition to that `clang-nvlink-wrapper` should diagnose unrecognized options rather than silently ignoring them. Do you agree?

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


More information about the cfe-commits mailing list