zlei created this revision. zlei added a reviewer: cfe-commits. This option is used to avoid underlinking. It's available in LLVM's main tree, but not in a standalone build of libc++. This patch ensures the option is passed in whether libc++ is built in-tree or out-of-tree.
https://reviews.llvm.org/D24119 Files: CMakeLists.txt Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -305,6 +305,18 @@ # so they don't get transformed into -Wno and -errors respectivly. remove_flags(-Wno-pedantic -pedantic-errors -pedantic) +# FIXME: this is cribbed from HandleLLVMOptions.cmake. +if(LIBCXX_STANDALONE_BUILD) + # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO + # build might work on ELF but fail on MachO/COFF. + if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR + ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND + NOT LLVM_USE_SANITIZER) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") + endif() +endif() + # Required flags ============================================================== set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -305,6 +305,18 @@ # so they don't get transformed into -Wno and -errors respectivly. remove_flags(-Wno-pedantic -pedantic-errors -pedantic) +# FIXME: this is cribbed from HandleLLVMOptions.cmake. +if(LIBCXX_STANDALONE_BUILD) + # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO + # build might work on ELF but fail on MachO/COFF. + if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR + ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND + NOT LLVM_USE_SANITIZER) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") + endif() +endif() + # Required flags ============================================================== set(LIBCXX_STANDARD_VER c++11 CACHE INTERNAL "internal option to change build dialect") add_compile_flags_if_supported(-std=${LIBCXX_STANDARD_VER})
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits