LLVM currently doesn't build with -DBUILD_SHARED_LIBS=ON on Solaris:
- Quite a number of libs fail to link like this:
Undefined first referenced symbol in file ceil lib/DebugInfo/Symbolize/CMakeFiles/LLVMSymbolize.dir/DIPrinter.cpp.o (symbol belongs to implicit dependency /usr/lib/amd64/libm.so.2)
This is due to linking with -z defs from llvm/cmake/modules/HandleLLVMOptions.cmake. Solaris ld requires shared objects to be self-contained. Due to the large number of affected libraries (roughly half of all), it's only practical to do this centrally.
- libLLVMTargetParser.so uses libkstat functions without linking it.
- libbenchmark.so likewise has a libm dependency which must be made explicit. This doesn't happen in upstream benchmark, but is also due to linking with z defs, so the patch must stay local to the LLVM tree.
Tested on amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11.
There are a couple of regressions:
- 34 instances on Solaris/amd64 of
LVM ERROR: Must use fast (default) register allocator for unoptimized regalloc.
which are probably due to differences in constructor ordering.
- Also a few instances of
Polly-Unit :: DeLICM/./DeLICMTests/failed_to_discover_tests_from_gtest
which I mean to address later. This patch is only about the build failure.