diff options
| author | Eric Fiselier <eric@efcs.ca> | 2014-10-18 01:15:17 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2014-10-18 01:15:17 +0000 |
| commit | 6f9da55c0ff5c55b0bef1bc4907f9ce0915a10aa (patch) | |
| tree | 2f6418e0c6a7626d4ade1ba6ce36c329630997d5 /libcxx/test | |
| parent | f83ba5eb0f6e928be6138de57ab3a6268e3baaf0 (diff) | |
| download | bcm5719-llvm-6f9da55c0ff5c55b0bef1bc4907f9ce0915a10aa.tar.gz bcm5719-llvm-6f9da55c0ff5c55b0bef1bc4907f9ce0915a10aa.zip | |
[libcxx] Add support for building and testing with an ABI library not along linker paths
Summary:
This patch adds support for building/testing libc++ with an ABI library that the linker would not normally find.
- `CMAKE_LIBRARY_PATH` is used to specify the list of search directories.
- The ABI library is now found using `find_library` instead of assuming its along the linker's search path.
- `CMAKE_LIBRARY_PATH` is passed to our LIT config as `library_paths`.
- For each path in `library_paths` the following flags are added `-L<path> -Wl,-rpath -Wl,<path>`
Some changes in existing behavior were also added:
- `target_link_libraries` is now passed the ABI library file instead of the library name. Ex `target_link_libraries(cxx "/usr/lib/libc++abi.so")` vs `target_link_libraries(cxx "c++abi")`.
- `-Wl,-rpath -Wl,<path>` is now used on OSX to link to libc++ instead of env['DYLD_LIBRARY_PATH'] if `use_system_lib=False`.
Reviewers: mclow.lists, danalbert, EricWF
Reviewed By: EricWF
Subscribers: emaste, cfe-commits
Differential Revision: http://reviews.llvm.org/D5038
llvm-svn: 220118
Diffstat (limited to 'libcxx/test')
| -rw-r--r-- | libcxx/test/lit.cfg | 29 | ||||
| -rw-r--r-- | libcxx/test/lit.site.cfg.in | 1 |
2 files changed, 19 insertions, 11 deletions
diff --git a/libcxx/test/lit.cfg b/libcxx/test/lit.cfg index fbeb827597b..6d30e5fcd91 100644 --- a/libcxx/test/lit.cfg +++ b/libcxx/test/lit.cfg @@ -197,6 +197,7 @@ class Configuration(object): self.obj_root = None self.env = {} self.compile_flags = [] + self.library_paths = [] self.link_flags = [] self.use_system_lib = False self.use_clang_verify = False @@ -366,9 +367,19 @@ class Configuration(object): # Configure extra compiler flags. self.compile_flags += ['-I' + self.src_root + '/include', '-I' + self.src_root + '/test/support'] + if sys.platform == 'linux2': + self.compile_flags += ['-D__STDC_FORMAT_MACROS', + '-D__STDC_LIMIT_MACROS', + '-D__STDC_CONSTANT_MACROS'] def configure_link_flags(self): - self.link_flags += ['-L' + self.obj_root + '/lib', '-lc++'] + # Configure library search paths + lpaths = self.get_lit_conf('library_paths', '').split(';') + lpaths = [l for l in lpaths if l.strip()] + self.link_flags += ['-L' + self.obj_root + '/lib'] + self.link_flags += ['-L' + l for l in lpaths] + # Configure libraries + self.link_flags += ['-lc++'] link_flags_str = self.get_lit_conf('link_flags') if link_flags_str is None: cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi') @@ -394,22 +405,18 @@ class Configuration(object): elif sys.platform.startswith('freebsd'): self.link_flags += ['-lc', '-lm', '-pthread', '-lgcc_s'] else: - self.lit_config.fatal("unrecognized system") + self.lit_config.fatal("unrecognized system: %r" % sys.platform) self.lit_config.note( "inferred link_flags as: %r" % self.link_flags) if link_flags_str: self.link_flags += shlex.split(link_flags_str) - if sys.platform == 'linux2': - if not self.use_system_lib: - self.link_flags += ['-Wl,-R', self.obj_root + '/lib'] - self.compile_flags += ['-D__STDC_FORMAT_MACROS', - '-D__STDC_LIMIT_MACROS', - '-D__STDC_CONSTANT_MACROS'] - elif sys.platform.startswith('freebsd'): - if not self.use_system_lib: - self.link_flags += ['-Wl,-R', self.obj_root + '/lib'] + # Configure library runtime search paths + if not self.use_system_lib: + self.link_flags += ['-Wl,-rpath', '-Wl,' + self.obj_root + '/lib'] + for l in lpaths: + self.link_flags += ['-Wl,-rpath', '-Wl,' + l] def configure_std_flag(self): # Try and get the std version from the command line. Fall back to diff --git a/libcxx/test/lit.site.cfg.in b/libcxx/test/lit.site.cfg.in index 3362d99e09e..0c5f2609874 100644 --- a/libcxx/test/lit.site.cfg.in +++ b/libcxx/test/lit.site.cfg.in @@ -7,6 +7,7 @@ config.python_executable = "@PYTHON_EXECUTABLE@" config.enable_shared = @LIBCXX_ENABLE_SHARED@ config.cxx_abi = "@LIBCXX_CXX_ABI_LIBNAME@" config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" +config.library_paths = "@CMAKE_LIBRARY_PATH@" # Let the main config do the real work. lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg") |

