<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Support building libc++.a as a linker script: INPUT(libc++.a.1 libc++abi.a)"
href="https://bugs.llvm.org/show_bug.cgi?id=46321">46321</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Support building libc++.a as a linker script: INPUT(libc++.a.1 libc++abi.a)
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>i@maskray.me
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Currently, if libc++.a does not include libc++abi.a (or other C++ ABI like
libcxxrt.a; see LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY), clang++ -static
-stdlib=libc++ is broken (libc++abi.a is not linked).
LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY (adding libc++abi.a members into
libc++.a) is one solution. Another (this feature request) is to
* Rename the real archive to libc++.a.1
* Make libc++.a a linker script: INPUT(libc++.a.1 libc++abi.a)
The scheme is similar to the libc++.so linker script (INPUT(libc++.so.1
-lc++abi)). This solution has the advantage that archive members are not
duplicated.
We can probably extend libcxx/cmake/Modules/DefineLinkerScript.cmake to support
libc++.a . This requires some CMake-fu.
---- Linker support
GNU ld from 2.35 onwards (<a href="https://sourceware.org/bugzilla/show_bug.cgi?id=25806">https://sourceware.org/bugzilla/show_bug.cgi?id=25806</a>
) and LLD>=11 support finding paths relative to the current linker script
<a href="https://reviews.llvm.org/D77779">https://reviews.llvm.org/D77779</a>. Gold has supported this since 2007
(<a href="https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=51dee2fec3afad5e6fc9f78b8c1d8486ebf3a334">https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=51dee2fec3afad5e6fc9f78b8c1d8486ebf3a334</a>
)</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>