<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 15, 2015 at 3:41 PM, Eric Fiselier via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ericwf<br>
Date: Thu Oct 15 17:41:51 2015<br>
New Revision: 250469<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=250469&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=250469&view=rev</a><br>
Log:<br>
[libcxx] Make libc++.so a linker script by default on most platforms.<br></blockquote><div><br></div><div>I think that this probably is release-note-worthy.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Summary:<br>
This patch turns on `LIBCXX_ENABLE_ABI_LINKER_SCRIPT` by default whenever `LLVM_HAVE_LINK_VERSION_SCRIPT` is ON. This turns out to be whenever:<br>
<br>
1. WIN32 is not defined.<br>
2 UNIX is defined.<br>
3. APPLE is not defined.<br>
<br>
While `LLVM_HAVE_LINK_VERSION_SCRIPT` is meant to reflect exactly what we are asking I think it's close enough.<br>
<br>
After committing this patch Linux users will no longer have to use "-lc++abi" explicitly!<br>
<br>
<br>
<br>
<br>
Reviewers: mclow.lists, danalbert, compnerd, jroelofs<br>
<br>
Subscribers: emaste, rengolin, cbergstrom, cfe-commits<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D13739" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13739</a><br>
<br>
Modified:<br>
    libcxx/trunk/CMakeLists.txt<br>
    libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake<br>
    libcxx/trunk/docs/BuildingLibcxx.rst<br>
    libcxx/trunk/docs/UsingLibcxx.rst<br>
<br>
Modified: libcxx/trunk/CMakeLists.txt<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=250469&r1=250468&r2=250469&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=250469&r1=250468&r2=250469&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/CMakeLists.txt (original)<br>
+++ libcxx/trunk/CMakeLists.txt Thu Oct 15 17:41:51 2015<br>
@@ -67,12 +67,22 @@ set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" C<br>
 set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)<br>
 set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})<br>
<br>
+# Use a static copy of the ABI library when linking libc++. This option<br>
+# cannot be used with LIBCXX_ENABLE_ABI_LINKER_SCRIPT.<br>
 option(LIBCXX_ENABLE_STATIC_ABI_LIBRARY "Statically link the ABI library" OFF)<br>
<br>
 # Generate and install a linker script inplace of libc++.so. The linker script<br>
-# will link libc++ to the correct ABI library.<br>
+# will link libc++ to the correct ABI library. This option is on by default<br>
+# On UNIX platforms other than Apple unless 'LIBCXX_ENABLE_STATIC_ABI_LIBRARY'<br>
+# is on.<br>
+set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE OFF)<br>
+if (LLVM_HAVE_LINK_VERSION_SCRIPT AND NOT LIBCXX_ENABLE_STATIC_ABI_LIBRARY)<br>
+    set(ENABLE_LINKER_SCRIPT_DEFAULT_VALUE ON)<br>
+endif()<br>
+<br>
 option(LIBCXX_ENABLE_ABI_LINKER_SCRIPT<br>
-      "Use and install a linker script for the given ABI library" OFF)<br>
+      "Use and install a linker script for the given ABI library"<br>
+      ${ENABLE_LINKER_SCRIPT_DEFAULT_VALUE})<br>
<br>
 # Build libc++abi with libunwind. We need this option to determine whether to<br>
 # link with libunwind or libgcc_s while running the test cases.<br>
<br>
Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=250469&r1=250468&r2=250469&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=250469&r1=250468&r2=250469&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original)<br>
+++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Thu Oct 15 17:41:51 2015<br>
@@ -109,6 +109,30 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR<br>
     message(STATUS "Sphinx disabled.")<br>
   endif()<br>
<br>
+  # FIXME - This is cribbed from HandleLLVMOptions.cmake.<br>
+  if(WIN32)<br>
+    set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)<br>
+    if(CYGWIN)<br>
+      set(LLVM_ON_WIN32 0)<br>
+      set(LLVM_ON_UNIX 1)<br>
+    else(CYGWIN)<br>
+      set(LLVM_ON_WIN32 1)<br>
+      set(LLVM_ON_UNIX 0)<br>
+    endif(CYGWIN)<br>
+  else(WIN32)<br>
+    if(UNIX)<br>
+      set(LLVM_ON_WIN32 0)<br>
+      set(LLVM_ON_UNIX 1)<br>
+      if(APPLE)<br>
+        set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)<br>
+      else(APPLE)<br>
+        set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)<br>
+      endif(APPLE)<br>
+    else(UNIX)<br>
+      MESSAGE(SEND_ERROR "Unable to determine platform")<br>
+    endif(UNIX)<br>
+  endif(WIN32)<br>
+<br>
   # Add LLVM Functions --------------------------------------------------------<br>
   include(AddLLVM OPTIONAL)<br>
 endif()<br>
<br>
Modified: libcxx/trunk/docs/BuildingLibcxx.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/BuildingLibcxx.rst?rev=250469&r1=250468&r2=250469&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/BuildingLibcxx.rst?rev=250469&r1=250468&r2=250469&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/docs/BuildingLibcxx.rst (original)<br>
+++ libcxx/trunk/docs/BuildingLibcxx.rst Thu Oct 15 17:41:51 2015<br>
@@ -170,6 +170,14 @@ ABI Library Specific Options<br>
   If this option is enabled, libc++ will try and link the selected ABI library<br>
   statically.<br>
<br>
+.. option:: LIBCXX_ENABLE_ABI_LINKER_SCRIPT:BOOL<br>
+<br>
+  **Default**: ``ON`` by default on UNIX platforms other than Apple unless<br>
+  'LIBCXX_ENABLE_STATIC_ABI_LIBRARY' is ON. Otherwise the default value is ``OFF``.<br>
+<br>
+  This option generate and installs a linker script as ``libc++.so`` which<br>
+  links the correct ABI library.<br>
+<br>
 .. option:: LIBCXXABI_USE_LLVM_UNWINDER:BOOL<br>
<br>
   **Default**: ``OFF``<br>
<br>
Modified: libcxx/trunk/docs/UsingLibcxx.rst<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/UsingLibcxx.rst?rev=250469&r1=250468&r2=250469&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/UsingLibcxx.rst?rev=250469&r1=250468&r2=250469&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/docs/UsingLibcxx.rst (original)<br>
+++ libcxx/trunk/docs/UsingLibcxx.rst Thu Oct 15 17:41:51 2015<br>
@@ -54,10 +54,10 @@ An example of using ``LD_LIBRARY_PATH``:<br>
 Using libc++ on Linux<br>
 =====================<br>
<br>
-On Linux libc++ typically links to a shared version of libc++abi. Unfortunately<br>
-you can't simply run clang with "-stdlib=libc++" as clang is not set up to<br>
-link for this configuration. To get around this you'll have to manually<br>
-link libc++abi yourself. For example:<br>
+On Linux libc++ can typically be used with only '-stdlib=libc++'. However<br>
+some libc++ installations require the user manually link libc++abi themselves.<br>
+If you are running into linker errors when using libc++ try adding '-lc++abi'<br>
+to the link line.  For example:<br>
<br>
 .. code-block:: bash<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org</div>
</div></div>