diff options
author | Michal Gorny <mgorny@gentoo.org> | 2016-10-08 10:27:45 +0000 |
---|---|---|
committer | Michal Gorny <mgorny@gentoo.org> | 2016-10-08 10:27:45 +0000 |
commit | 2433b26176f2e390f0771e4bb88cc73b6b18d817 (patch) | |
tree | 0cfc070f95ca0ea7a8796c96ca8170df4f9b5fec /libcxx/utils/gen_link_script/gen_link_script.py | |
parent | ab61c74f93c046f2e4a0eb473959d15fb8e577fc (diff) | |
download | bcm5719-llvm-2433b26176f2e390f0771e4bb88cc73b6b18d817.tar.gz bcm5719-llvm-2433b26176f2e390f0771e4bb88cc73b6b18d817.zip |
[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
llvm-svn: 283659
Diffstat (limited to 'libcxx/utils/gen_link_script/gen_link_script.py')
-rwxr-xr-x | libcxx/utils/gen_link_script/gen_link_script.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/libcxx/utils/gen_link_script/gen_link_script.py b/libcxx/utils/gen_link_script/gen_link_script.py index 9f1f0b771fc..cb42af9c487 100755 --- a/libcxx/utils/gen_link_script/gen_link_script.py +++ b/libcxx/utils/gen_link_script/gen_link_script.py @@ -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. |