[libcxx] Redo adding support for building and testing with an ABI library not along linker paths
Summary: This is the second attempt at allowing for the use of libraries that the linker cannot find. The first attempt used `CMAKE_LIBRARY_PATH` and `find_library` to select which ABI library should be used. There were a number of problems with this approach: - `find_library` didn't work with cmake targets (ie in-tree libcxxabi build) - It wasn't always possible to determine where `find_library` actually found your library. - `target_link_libraries` inserted the path of the ABI library into libc++'s RPATH when `find_library` was used. - Linking libc++ and it's ABI library is a special case. It's a lot easier to keep it simple. After discussion with @cbergstrum a new approach was decided upon. This patch achieve the same ends by simply using `LIBCXX_CXX_ABI_LIBRARY_PATH` to specify where to find the library (if the linker won't find it). When this variable is defined it is simply added as a library search path when linking libc++. It is a lot easier to duplicate this behavior in LIT. It also prevents libc++ from being linked with an RPATH. Reviewers: mclow.lists, cbergstrom, chandlerc, danalbert Reviewed By: chandlerc, danalbert Subscribers: chandlerc, cfe-commits Differential Revision: http://reviews.llvm.org/D5860 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220157 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
14
test/lit.cfg
14
test/lit.cfg
@@ -374,10 +374,13 @@ class Configuration(object):
|
||||
|
||||
def configure_link_flags(self):
|
||||
# Configure library search paths
|
||||
lpaths = self.get_lit_conf('library_paths', '').split(';')
|
||||
lpaths = [l for l in lpaths if l.strip()]
|
||||
abi_library_path = self.get_lit_conf('abi_library_path', '')
|
||||
self.link_flags += ['-L' + self.obj_root + '/lib']
|
||||
self.link_flags += ['-L' + l for l in lpaths]
|
||||
if not self.use_system_lib:
|
||||
self.link_flags += ['-Wl,-rpath', '-Wl,' + self.obj_root + '/lib']
|
||||
if abi_library_path:
|
||||
self.link_flags += ['-L' + abi_library_path,
|
||||
'-Wl,-rpath', '-Wl,' + abi_library_path]
|
||||
# Configure libraries
|
||||
self.link_flags += ['-lc++']
|
||||
link_flags_str = self.get_lit_conf('link_flags')
|
||||
@@ -412,11 +415,6 @@ class Configuration(object):
|
||||
if link_flags_str:
|
||||
self.link_flags += shlex.split(link_flags_str)
|
||||
|
||||
# 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
|
||||
|
||||
@@ -7,7 +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@"
|
||||
config.abi_library_path = "@LIBCXX_CXX_ABI_LIBRARY_PATH@"
|
||||
|
||||
# Let the main config do the real work.
|
||||
lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
|
||||
|
||||
Reference in New Issue
Block a user