----- Original Message ----- > From: "Hal Finkel" <hfin...@anl.gov> > To: "Hal Finkel" <hfin...@anl.gov> > Cc: cfe-commits@lists.llvm.org, "Michal Gorny" <mgo...@gentoo.org> > Sent: Saturday, October 8, 2016 9:43:02 PM > Subject: Re: [libcxx] r283659 - [cmake] Split linked libraries into private & > public, for linker script > > ----- Original Message ----- > > From: "Hal Finkel" <hfin...@anl.gov> > > To: "Hal Finkel" <hfin...@anl.gov> > > Cc: cfe-commits@lists.llvm.org, "Michal Gorny" <mgo...@gentoo.org> > > Sent: Saturday, October 8, 2016 9:34:58 PM > > Subject: Re: [libcxx] r283659 - [cmake] Split linked libraries into > > private & public, for linker script > > > > ----- Original Message ----- > > > From: "Hal Finkel via cfe-commits" <cfe-commits@lists.llvm.org> > > > To: "Michal Gorny" <mgo...@gentoo.org> > > > Cc: cfe-commits@lists.llvm.org > > > Sent: Saturday, October 8, 2016 6:37:50 PM > > > Subject: Re: [libcxx] r283659 - [cmake] Split linked libraries > > > into > > > private & public, for linker script > > > > > > Hi Michal, > > > > > > All of the libc++ and libc++abi regression tests are now failing > > > on > > > my Linux build system with this error: > > > > > > /usr/bin/ld: cannot find -lcxxabi_shared > > > > Alright, the problem here is that you've assumed, by doing this: > > > > > > ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py > > > > ARGS > > > > "$<TARGET_LINKER_FILE:cxx_shared>" > > > > - "${SCRIPT_ABI_LIBNAME}" > > > > + "\"${LIBCXX_LIBRARIES_PUBLIC}\"" > > Ah, I see. The code right about this used to handle this situation: > > # 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(SCRIPT_ABI_LIBNAME "${LIBCXX_CXX_ABI_LIBRARY}") > if (SCRIPT_ABI_LIBNAME STREQUAL "cxxabi_shared") > set(SCRIPT_ABI_LIBNAME "c++abi") > endif() > > and now it doesn't because you no longer use SCRIPT_ABI_LIBNAME as > the argument to gen_link_script.py. Let me see if I can fix this...
r283684 -Hal > > -Hal > > > > > that all of the items in the LIBCXX_LIBRARIES_PUBLIC list are > > actual > > library names. They might not be, but rather, they might be CMake > > targets instead: > > > > elseif ("${LIBCXX_CXX_ABI_LIBNAME}" STREQUAL "libcxxabi") > > if (LIBCXX_CXX_ABI_INTREE) > > # Link against just-built "cxxabi" target. > > if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) > > set(CXXABI_LIBNAME cxxabi_static) > > else() > > set(CXXABI_LIBNAME cxxabi_shared) > > endif() > > set(LIBCXX_LIBCPPABI_VERSION "2" PARENT_SCOPE) > > else() > > # Assume c++abi is installed in the system, rely on -lc++abi > > link > > flag. > > set(CXXABI_LIBNAME "c++abi") > > endif() > > > > So we might have cxxabi_static or cxxabi_shared in the list. > > > > -Hal > > > > > > > > My build directory has only these: > > > > > > lib/libc++.a > > > lib/libc++abi.so > > > lib/libc++abi.so.1 > > > lib/libc++abi.so.1.0 > > > lib/libc++experimental.a > > > lib/libc++.so > > > lib/libc++.so.1 > > > lib/libc++.so.1.0 > > > > > > -Hal > > > > > > ----- Original Message ----- > > > > From: "Michal Gorny via cfe-commits" > > > > <cfe-commits@lists.llvm.org> > > > > To: cfe-commits@lists.llvm.org > > > > Sent: Saturday, October 8, 2016 5:27:46 AM > > > > Subject: [libcxx] r283659 - [cmake] Split linked libraries into > > > > private & public, for linker script > > > > > > > > Author: mgorny > > > > Date: Sat Oct 8 05:27:45 2016 > > > > New Revision: 283659 > > > > > > > > URL: http://llvm.org/viewvc/llvm-project?rev=283659&view=rev > > > > Log: > > > > [cmake] Split linked libraries into private & public, for > > > > linker > > > > script > > > > > > > > Introduce LIBCXX_LIBRARIES_PUBLIC in addition to > > > > LIBCXX_LIBRARIES > > > > that > > > > holds 'public' interface libraries -- that is, libraries that > > > > both > > > > libc++ links to and programs linked against it need to link to. > > > > > > > > Currently this includes the ABI library and optionally -lunwind > > > > (when > > > > LIBCXXABI_USE_LLVM_UNWINDER is on). The libraries are included > > > > in > > > > the > > > > linker script, in order to make it possible to link C++ > > > > programs > > > > using > > > > clang with compiler-rt runtime out-of-the-box. > > > > > > > > Differential Revision: https://reviews.llvm.org/D25008 > > > > > > > > Modified: > > > > libcxx/trunk/CMakeLists.txt > > > > libcxx/trunk/lib/CMakeLists.txt > > > > libcxx/trunk/utils/gen_link_script/gen_link_script.py > > > > > > > > Modified: libcxx/trunk/CMakeLists.txt > > > > URL: > > > > http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=283659&r1=283658&r2=283659&view=diff > > > > ============================================================================== > > > > --- libcxx/trunk/CMakeLists.txt (original) > > > > +++ libcxx/trunk/CMakeLists.txt Sat Oct 8 05:27:45 2016 > > > > @@ -270,9 +270,13 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB > > > > # LIBCXX_CXX_FLAGS: General flags for both the compiler and > > > > linker. > > > > # LIBCXX_COMPILE_FLAGS: Compile only flags. > > > > # LIBCXX_LINK_FLAGS: Linker only flags. > > > > +# LIBCXX_LIBRARIES: Private libraries libc++ is linked to. > > > > +# LIBCXX_LIBRARIES_PUBLIC: Public libraries libc++ is linked > > > > to, > > > > +# also exposed in the linker script. > > > > set(LIBCXX_COMPILE_FLAGS "") > > > > set(LIBCXX_LINK_FLAGS "") > > > > set(LIBCXX_LIBRARIES "") > > > > +set(LIBCXX_LIBRARIES_PUBLIC "") > > > > > > > > # Include macros for adding and removing libc++ flags. > > > > include(HandleLibcxxFlags) > > > > > > > > Modified: libcxx/trunk/lib/CMakeLists.txt > > > > URL: > > > > http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=283659&r1=283658&r2=283659&view=diff > > > > ============================================================================== > > > > --- libcxx/trunk/lib/CMakeLists.txt (original) > > > > +++ libcxx/trunk/lib/CMakeLists.txt Sat Oct 8 05:27:45 2016 > > > > @@ -33,9 +33,17 @@ add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY > > > > > > > > add_library_flags_if(LIBCXX_COVERAGE_LIBRARY > > > > "${LIBCXX_COVERAGE_LIBRARY}") > > > > > > > > -add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY > > > > "-Wl,--whole-archive" "-Wl,-Bstatic") > > > > -add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}") > > > > -add_library_flags_if(LIBCXX_ENABLE_STATIC_ABI_LIBRARY > > > > "-Wl,-Bdynamic" "-Wl,--no-whole-archive") > > > > +if (LIBCXX_ENABLE_STATIC_ABI_LIBRARY) > > > > + add_library_flags("-Wl,--whole-archive" "-Wl,-Bstatic") > > > > + add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}") > > > > + add_library_flags("-Wl,-Bdynamic" "-Wl,--no-whole-archive") > > > > +elseif (APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" > > > > OR > > > > + LIBCXX_CXX_ABI_LIBNAME STREQUAL "none")) > > > > + # Apple re-exports libc++abi in libc++, so don't make it > > > > public > > > > + add_library_flags("${LIBCXX_CXX_ABI_LIBRARY}") > > > > +else() > > > > + list(APPEND LIBCXX_LIBRARIES_PUBLIC > > > > "${LIBCXX_CXX_ABI_LIBRARY}") > > > > +endif() > > > > > > > > if (APPLE AND LLVM_USE_SANITIZER) > > > > if (("${LLVM_USE_SANITIZER}" STREQUAL "Address") OR > > > > @@ -67,7 +75,7 @@ if (APPLE AND LLVM_USE_SANITIZER) > > > > endif() > > > > endif() > > > > > > > > -# Generate library list. > > > > +# Generate private library list. > > > > add_library_flags_if(LIBCXX_HAS_PTHREAD_LIB pthread) > > > > add_library_flags_if(LIBCXX_HAS_C_LIB c) > > > > add_library_flags_if(LIBCXX_HAS_M_LIB m) > > > > @@ -75,6 +83,11 @@ add_library_flags_if(LIBCXX_HAS_RT_LIB r > > > > add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s) > > > > add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic) > > > > > > > > +# Add the unwinder library. > > > > +if (LIBCXXABI_USE_LLVM_UNWINDER) > > > > + list(APPEND LIBCXX_LIBRARIES_PUBLIC unwind) > > > > +endif() > > > > + > > > > # Setup flags. > > > > if (NOT WIN32) > > > > add_flags_if_supported(-fPIC) > > > > @@ -151,7 +164,9 @@ set(LIBCXX_TARGETS) > > > > # Build the shared library. > > > > if (LIBCXX_ENABLE_SHARED) > > > > add_library(cxx_shared SHARED $<TARGET_OBJECTS:cxx_objects>) > > > > - target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) > > > > + target_link_libraries(cxx_shared > > > > + PRIVATE ${LIBCXX_LIBRARIES} > > > > + PUBLIC ${LIBCXX_LIBRARIES_PUBLIC}) > > > > set_target_properties(cxx_shared > > > > PROPERTIES > > > > LINK_FLAGS "${LIBCXX_LINK_FLAGS}" > > > > @@ -165,7 +180,9 @@ endif() > > > > # Build the static library. > > > > if (LIBCXX_ENABLE_STATIC) > > > > add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>) > > > > - target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) > > > > + target_link_libraries(cxx_static > > > > + PRIVATE ${LIBCXX_LIBRARIES} > > > > + PUBLIC ${LIBCXX_LIBRARIES_PUBLIC}) > > > > set_target_properties(cxx_static > > > > PROPERTIES > > > > LINK_FLAGS "${LIBCXX_LINK_FLAGS}" > > > > @@ -238,7 +255,7 @@ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENAB > > > > ${PYTHON_EXECUTABLE} > > > > ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py > > > > ARGS > > > > "$<TARGET_LINKER_FILE:cxx_shared>" > > > > - "${SCRIPT_ABI_LIBNAME}" > > > > + "\"${LIBCXX_LIBRARIES_PUBLIC}\"" > > > > WORKING_DIRECTORY ${LIBCXX_BUILD_DIR} > > > > ) > > > > endif() > > > > > > > > Modified: libcxx/trunk/utils/gen_link_script/gen_link_script.py > > > > URL: > > > > http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/gen_link_script/gen_link_script.py?rev=283659&r1=283658&r2=283659&view=diff > > > > ============================================================================== > > > > --- libcxx/trunk/utils/gen_link_script/gen_link_script.py > > > > (original) > > > > +++ libcxx/trunk/utils/gen_link_script/gen_link_script.py Sat > > > > Oct > > > > 8 > > > > 05:27:45 2016 > > > > @@ -22,7 +22,7 @@ def help_and_exit(): > > > > help_msg = \ > > > > """Usage > > > > > > > > - gen_link_script.py [--help] [--dryrun] <path/to/libcxx.so> > > > > <abi_libname> > > > > + gen_link_script.py [--help] [--dryrun] <path/to/libcxx.so> > > > > <public_libs> > > > > > > > > Generate a linker script that links libc++ to the proper ABI > > > > library. > > > > The script replaces the specified libc++ symlink. > > > > @@ -31,8 +31,7 @@ def help_and_exit(): > > > > Arguments > > > > <path/to/libcxx.so> - The top level symlink to the versioned > > > > libc++ shared > > > > library. This file is replaced with a > > > > linker > > > > script. > > > > - <abi_libname> - The name of the ABI library to use in > > > > the > > > > linker script. > > > > - The name must be one of [c++abi, > > > > stdc++, > > > > supc++, cxxrt]. > > > > + <public_libs> - List of library names to include in > > > > linker > > > > script. > > > > > > > > Exit Status: > > > > 0 if OK, > > > > @@ -53,11 +52,11 @@ def parse_args(): > > > > if len(args) != 2: > > > > usage_and_exit() > > > > symlink_file = args[0] > > > > - abi_libname = args[1] > > > > - return dryrun, symlink_file, abi_libname > > > > + public_libs = args[1].split(';') > > > > + return dryrun, symlink_file, public_libs > > > > > > > > def main(): > > > > - dryrun, symlink_file, abi_libname = parse_args() > > > > + dryrun, symlink_file, public_libs = parse_args() > > > > > > > > # Check that the given libc++.so file is a valid symlink. > > > > if not os.path.islink(symlink_file): > > > > @@ -66,15 +65,12 @@ def main(): > > > > # Read the symlink so we know what libc++ to link to in > > > > the > > > > linker script. > > > > linked_libcxx = os.readlink(symlink_file) > > > > > > > > - # Check that the abi_libname is one of the supported > > > > values. > > > > - supported_abi_list = ['c++abi', 'stdc++', 'supc++', > > > > 'cxxrt'] > > > > - if abi_libname not in supported_abi_list: > > > > - print_and_exit("abi name '%s' is not supported: Use > > > > one > > > > of > > > > %r" % > > > > - (abi_libname, supported_abi_list)) > > > > + # Prepare the list of public libraries to link. > > > > + public_libs = ['-l%s' % l for l in public_libs] > > > > > > > > # Generate the linker script contents and print the script > > > > and > > > > destination > > > > # information. > > > > - contents = "INPUT(%s -l%s)" % (linked_libcxx, abi_libname) > > > > + contents = "INPUT(%s %s)" % (linked_libcxx, ' > > > > '.join(public_libs)) > > > > print("GENERATING SCRIPT: '%s' as file %s" % (contents, > > > > symlink_file)) > > > > > > > > # Remove the existing libc++ symlink and replace it with > > > > the > > > > script. > > > > > > > > > > > > _______________________________________________ > > > > cfe-commits mailing list > > > > cfe-commits@lists.llvm.org > > > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > > > > > > > > > -- > > > Hal Finkel > > > Lead, Compiler Technology and Programming Languages > > > Leadership Computing Facility > > > Argonne National Laboratory > > > _______________________________________________ > > > cfe-commits mailing list > > > cfe-commits@lists.llvm.org > > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > > > > > > -- > > Hal Finkel > > Lead, Compiler Technology and Programming Languages > > Leadership Computing Facility > > Argonne National Laboratory > > > > -- > Hal Finkel > Lead, Compiler Technology and Programming Languages > Leadership Computing Facility > Argonne National Laboratory > -- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits