[PATCH] D12508: [libcxx] Make it drastically simpler to link libc++.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 16:50:03 PDT 2015


EricWF created this revision.
EricWF added reviewers: mclow.lists, danalbert, jroelofs, rsmith.
EricWF added a subscriber: cfe-commits.

Currently on most platforms you have to manually link the c++ abi library used with libc++ whenever you use libc++. So your typical libc++ command like invocation might look like:

```
clang++ -stdlib=libc++ foo.cpp -lc++abi
```

Having to manually link `libc++abi.so` makes it harder for libc++ to be used generically. This patch fixes that by generating a linker script for `libc++.so` that correctly links the ABI library. On linux the linker script for libc++abi would look like:

```
# libc++.so
INPUT(libc++.so.1 -lc++abi)
```

With the linker script you can now use libc++ using only `-stdlib=libc++`. This is the technique that is used on FreeBSD in ordered to link cxxrt and I think it's the best approach to make our users lives simpler.

The CMake option used to enable this is `LIBCXX_ENABLE_ABI_LINKER_SCRIPT`. In future I would like to enable this by default on all platforms except for Darwin.

http://reviews.llvm.org/D12508

Files:
  CMakeLists.txt
  lib/CMakeLists.txt
  test/CMakeLists.txt
  utils/gen_link_script/gen_link_script.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12508.33645.patch
Type: text/x-patch
Size: 6565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150831/1017755d/attachment-0001.bin>


More information about the cfe-commits mailing list