<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - llvm-shlib: Shared library contains (almost) no symbols on SunOS"
href="https://llvm.org/bugs/show_bug.cgi?id=28971">28971</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>llvm-shlib: Shared library contains (almost) no symbols on SunOS
</td>
</tr>
<tr>
<th>Product</th>
<td>Build scripts
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>cmake
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mgorny@gentoo.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16943" name="attach_16943" title="Patch fixing the issue">attachment 16943</a> <a href="attachment.cgi?id=16943&action=edit" title="Patch fixing the issue">[details]</a></span>
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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>