[PATCH] Fix re-building in-tree libc++ against in-tree libc++abi

Viktor Kutuzov vkutuzov at accesssoftek.com
Wed Aug 6 02:10:28 PDT 2014


Hi samsonov, danalbert,

Since the LIBCXX_CXX_ABI variable is a cached one, the code that detects in-tree libc++abi (added in rL214037) only executes during the initial build, so any successive builds actually link against the system (and not the in-tree) libc++abi.

This patch fixes that bug by introducing a dedicated non-cached variable LIB_CXX_ABI_LIBNAME.

http://reviews.llvm.org/D4805

Files:
  CMakeLists.txt
  test/lit.site.cfg.in

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -45,15 +45,15 @@
 option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
 
 set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
-if (NOT DEFINED LIBCXX_CXX_ABI)
-  if (NOT DEFINED LIBCXX_BUILT_STANDALONE AND IS_DIRECTORY "${CMAKE_SOURCE_DIR}/projects/libcxxabi")
-    set(LIBCXX_CXX_ABI "libcxxabi")
-    set(LIBCXX_LIBCXXABI_INCLUDE_PATHS "${CMAKE_SOURCE_DIR}/projects/libcxxabi/include")
-    set(LIBCXX_CXX_ABI_INTREE 1)
-  else ()
-    set(LIBCXX_CXX_ABI "none")
-  endif ()
-endif()
+if (NOT DEFINED LIBCXX_CXX_ABI AND
+    NOT DEFINED LIBCXX_BUILT_STANDALONE AND
+    IS_DIRECTORY "${CMAKE_SOURCE_DIR}/projects/libcxxabi")
+  set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
+  set(LIBCXX_LIBCXXABI_INCLUDE_PATHS "${CMAKE_SOURCE_DIR}/projects/libcxxabi/include")
+  set(LIBCXX_CXX_ABI_INTREE 1)
+else ()
+  set(LIBCXX_CXX_ABI_LIBNAME "none")
+endif ()
 set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
     "Specify C++ ABI library to use." FORCE)
 set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
@@ -134,13 +134,13 @@
     )
 endmacro()
 
-if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++" OR
-    "${LIBCXX_CXX_ABI}" STREQUAL "libsupc++")
+if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++" OR
+    "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libsupc++")
   set(_LIBSUPCXX_INCLUDE_FILES
     cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
     bits/cxxabi_tweaks.h bits/cxxabi_forced.h
     )
-  if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++")
+  if ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libstdc++")
     set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
     set(_LIBSUPCXX_LIBNAME stdc++)
   else()
@@ -151,7 +151,7 @@
     "-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
     "${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
     )
-elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
+elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi")
   if (LIBCXX_CXX_ABI_INTREE)
     # Link against just-built "cxxabi" target.
     set(CXXABI_LIBNAME cxxabi)
@@ -162,11 +162,11 @@
   setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
     ${CXXABI_LIBNAME} "cxxabi.h" ""
     )
-elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
+elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxrt")
   setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
     "cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
     )
-elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none")
+elseif (NOT "${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "none")
   message(FATAL_ERROR
     "Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
     "supported for c++ abi."
Index: test/lit.site.cfg.in
===================================================================
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -5,7 +5,7 @@
 config.libcxx_obj_root       = "@LIBCXX_BINARY_DIR@"
 config.python_executable     = "@PYTHON_EXECUTABLE@"
 config.enable_shared         = @LIBCXX_ENABLE_SHARED@
-config.cxx_abi               = "@LIBCXX_CXX_ABI@"
+config.cxx_abi               = "@LIBCXX_CXX_ABI_LIBNAME@"
 
 # Let the main config do the real work.
 lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4805.12226.patch
Type: text/x-patch
Size: 3268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140806/b9f6f5d0/attachment.bin>


More information about the llvm-commits mailing list