ninja check-all currently fails on Illumos:
[84/716] Generating default/Asan-i386-inline-Test FAILED: projects/compiler-rt/lib/asan/tests/default/Asan-i386-inline-Test cd /var/llvm/dist-amd64-release/projects/compiler-rt/lib/asan/tests && /var/llvm/dist-amd64-release/./bin/clang ASAN_INST_TEST_OBJECTS.gtest-all.cc.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_globals_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_interface_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_internal_interface_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_oob_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_mem_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_str_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_test_main.cpp.i386-inline.o -o /var/llvm/dist-amd64-release/projects/compiler-rt/lib/asan/tests/default/./Asan-i386-inline-Test -g --driver-mode=g++ -fsanitize=address -m32 ld: fatal: unrecognized option '--no-as-needed' ld: fatal: use the -z help option for usage information clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
clang unconditionally passes --as-needed/--no-as-needed to the linker. This works
on Solaris 11.[34] which added a couple of option aliases to the native linker to improve
compatibility with GNU ld. Illumos ld didn't do this, so one needs to use the corresponding
native options -z ignore/-z record instead.
Because this works on both Solaris and Illumos, the current patch always passes the
native options on Solaris. This isn't fully correct, however: when using GNU ld on
Solaris (not yet supported; I'm working on that), one still needs --as-needed instead.
I'm hardcoding this decision because a generic detection via a cmake test is hard:
many systems have their own implementation of getDefaultLinker and cmake would
have to duplicate the information encoded there. Besides, it would still break when
-fuse-ld is used.
Tested on amd64-pc-solaris2.11 (Solaris 11.4 and OpenIndiana 2020.04), sparcv9-sun-solaris2.11, and
x86_64-pc-linux-gnu.
ignore seems strange. How about start?