[llvm-bugs] [Bug 28971] New: llvm-shlib: Shared library contains (almost) no symbols on SunOS
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Aug 13 12:04:30 PDT 2016
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: unassignedbugs at nondot.org
Reporter: mgorny at gentoo.org
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160813/a7df4a31/attachment.html>
More information about the llvm-bugs
mailing list