https://llvm.org/bugs/show_bug.cgi?id=28971
Bug ID: 28971 Summary: llvm-shlib: Shared library contains (almost) no symbols on SunOS Product: Build scripts Version: trunk Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: cmake Assignee: unassignedb...@nondot.org Reporter: mgo...@gentoo.org CC: llvm-bugs@lists.llvm.org Classification: Unclassified Created attachment 16943 --> https://llvm.org/bugs/attachment.cgi?id=16943&action=edit Patch fixing the issue When building on SunOS (OpenIndiana 5.11) with -DLLVM_BUILD_LLVM_DYLIB=ON, the shared library contains almost no symbols. It seems that the root cause is that -Wl,--whole-archive is not passed (anymore) to the linker. tools/llvm-shlib/CMakeLists.txt has: if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") # FIXME: It should be "GNU ld for elf" # GNU ld doesn't resolve symbols in the version script. set(LIB_NAMES -Wl,--whole-archive ${LIB_NAMES} -Wl,--no-whole-archive) elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) endif() So it seems that -Wl,--whole-archive is passed only on Linux. The SunOS linker supports (and requires) that option as well. I don't really understand the comment about version scripts (esp. that AFAIU no version script is used by default). However, adding OR for SunOS fixes the issue for me. I'm attaching a trivial patch that does exactly that. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs