From 1ea8bb39b9c4ec71bb53196a2cdfa001328e1cac Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 8 Oct 2019 21:10:20 +0000 Subject: [libc++] Move the linker script generation step to CMake Summary: This allows the linker script generation to query CMake properties (specifically the dependencies of libc++.so) instead of having to carry these dependencies around manually in global variables. Notice the removal of the LIBCXX_INTERFACE_LIBRARIES global variable. Reviewers: phosek, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68343 llvm-svn: 374116 --- libcxx/src/CMakeLists.txt | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'libcxx/src') diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index fc14b1e71a3..120505fe18d 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -177,12 +177,10 @@ if (LIBCXX_ENABLE_SHARED) if (LIBCXXABI_USE_LLVM_UNWINDER) if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND)) target_link_libraries(cxx_shared PUBLIC unwind_shared) - list(APPEND LIBCXX_INTERFACE_LIBRARIES unwind_shared) # For the linker script elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND)) # libunwind is already included in libc++abi else() - target_link_libraries(cxx_shared PRIVATE unwind) - list(APPEND LIBCXX_INTERFACE_LIBRARIES unwind) # For the linker script + target_link_libraries(cxx_shared PUBLIC unwind) endif() endif() @@ -195,7 +193,6 @@ if (LIBCXX_ENABLE_SHARED) endif() else() target_link_libraries(cxx_shared PUBLIC "${LIBCXX_CXX_SHARED_ABI_LIBRARY}") - list(APPEND LIBCXX_INTERFACE_LIBRARIES "${LIBCXX_CXX_SHARED_ABI_LIBRARY}") # For the linker script endif() # Maybe re-export symbols from libc++abi @@ -222,31 +219,10 @@ if (LIBCXX_ENABLE_SHARED) endif() endif() - # Generate a linker script in place of a libc++.so symlink. Rerun this command - # after cxx builds. + # Generate a linker script in place of a libc++.so symlink. if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) - # Get the name of the ABI library and handle the case where CXXABI_LIBNAME - # is a target name and not a library. Ex cxxabi_shared. - set(LIBCXX_INTERFACE_LIBRARY_NAMES) - foreach(lib ${LIBCXX_INTERFACE_LIBRARIES}) - # FIXME: Handle cxxabi_static and unwind_static. - if (TARGET ${lib} OR - (${lib} MATCHES "cxxabi(_static|_shared)?" AND HAVE_LIBCXXABI) OR - (${lib} MATCHES "unwind(_static|_shared)?" AND HAVE_LIBUNWIND)) - list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "$") - else() - list(APPEND LIBCXX_INTERFACE_LIBRARY_NAMES "${lib}") - endif() - endforeach() - add_custom_command(TARGET cxx_shared POST_BUILD - COMMAND - ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script.py - ARGS - --input "$" - --output "$" - ${LIBCXX_INTERFACE_LIBRARY_NAMES} - WORKING_DIRECTORY ${LIBCXX_BUILD_DIR} - ) + include(DefineLinkerScript) + define_linker_script(cxx_shared) endif() list(APPEND LIBCXX_BUILD_TARGETS "cxx_shared") -- cgit v1.2.3