[PATCH] D85309: [Driver] Support GNU ld on Solaris
Rainer Orth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 30 07:40:44 PDT 2023
ro updated this revision to Diff 554711.
ro retitled this revision from "[WIP][clang][Driver] Support GNU ld on Solaris" to "[Driver] Support GNU ld on Solaris".
ro added a comment.
Herald added subscribers: llvm-commits, Sanitizers, Enna1, ormris.
Herald added a reviewer: sscalpone.
Herald added a reviewer: awarzynski.
Herald added projects: Sanitizers, LLVM, Flang, All.
This is a major revison of the original WIP patch that should be (close to) ready. Major differences are:
- Linker selection is dynamic now: one can switch between Solaris ld and GNU ld at runtime, with the default selectable with `-DCLANG_DEFAULT_LINKER`.
- Testcases have been adjusted to test both variants in case there are differences.
- The `compiler-rt/cmake/config-ix.cmake` and `llvm/cmake/modules/AddLLVM.cmake` changes to restrict the tests to Solaris ld are necessary because GNU accepts unknown `-z` options, but warns every time they are used, creating a lot of noise. Since there seems to be no way to check for those warnings in `llvm_check_compiler_linker_flag` or `llvm_check_compiler_linker_flag`, I restrict the cmake tests to Solaris ld in the first place.
- The changes to `clang/test/Driver/hip-link-bundle-archive.hip` and `flang/test/Driver/linker-flags.f90` are required to handle the `-DCLANG_DEFAULT_LINKER=gld` case: when this is passed to `cmake`, the `WebAssembly.cpp` `getLinkerPath` returns `/usr/bin/gld` instead of the expected `link`.
- `compiler-rt/test/asan/TestCases/global-location-nodebug.cpp` needs to enforce the Solaris ld, otherwise the test would `XPASS` with GNU ld which has the `-S` semantics expected by the test.
Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11` with both `-DCLANG_DEFAULT_LINKER=gld` and the default, and `x86_64-pc-linux-gnu`. No regressions in either case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85309/new/
https://reviews.llvm.org/D85309
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/CommonArgs.h
clang/lib/Driver/ToolChains/Solaris.cpp
clang/lib/Driver/ToolChains/Solaris.h
clang/test/Driver/hip-link-bundle-archive.hip
clang/test/Driver/solaris-ld-sanitizer.c
clang/test/Driver/solaris-ld.c
compiler-rt/cmake/config-ix.cmake
compiler-rt/test/asan/TestCases/global-location-nodebug.cpp
flang/test/Driver/linker-flags.f90
llvm/cmake/modules/AddLLVM.cmake
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85309.554711.patch
Type: text/x-patch
Size: 24225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230830/c21467ae/attachment-0001.bin>
More information about the cfe-commits
mailing list