[llvm-bugs] [Bug 46321] New: Support building libc++.a as a linker script: INPUT(libc++.a.1 libc++abi.a)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 14 17:36:40 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46321

            Bug ID: 46321
           Summary: Support building libc++.a as a linker script:
                    INPUT(libc++.a.1 libc++abi.a)
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: i at maskray.me
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

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 (https://sourceware.org/bugzilla/show_bug.cgi?id=25806
) and LLD>=11 support finding paths relative to the current linker script
https://reviews.llvm.org/D77779. Gold has supported this since 2007
(https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=51dee2fec3afad5e6fc9f78b8c1d8486ebf3a334
)

-- 
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/20200615/b123dcb3/attachment.html>


More information about the llvm-bugs mailing list