Refactor the lit config's linker flag discovery code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225920 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
083e011d6c
commit
f1b1b7f8fe
@ -337,11 +337,23 @@ class Configuration(object):
|
|||||||
if abi_library_path:
|
if abi_library_path:
|
||||||
self.link_flags += ['-L' + abi_library_path,
|
self.link_flags += ['-L' + abi_library_path,
|
||||||
'-Wl,-rpath,' + abi_library_path]
|
'-Wl,-rpath,' + abi_library_path]
|
||||||
|
|
||||||
# Configure libraries
|
# Configure libraries
|
||||||
|
self.configure_link_flags_cxx_library()
|
||||||
|
self.configure_link_flags_abi_library()
|
||||||
|
self.configure_extra_library_flags()
|
||||||
|
|
||||||
|
link_flags_str = self.get_lit_conf('link_flags', '')
|
||||||
|
self.link_flags += shlex.split(link_flags_str)
|
||||||
|
|
||||||
|
def configure_link_flags_cxx_library(self):
|
||||||
|
libcxx_library = self.get_lit_conf('libcxx_library')
|
||||||
if libcxx_library:
|
if libcxx_library:
|
||||||
self.link_flags += [libcxx_library]
|
self.link_flags += [libcxx_library]
|
||||||
else:
|
else:
|
||||||
self.link_flags += ['-lc++']
|
self.link_flags += ['-lc++']
|
||||||
|
|
||||||
|
def configure_link_flags_abi_library(self):
|
||||||
cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi')
|
cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi')
|
||||||
if cxx_abi == 'libstdc++':
|
if cxx_abi == 'libstdc++':
|
||||||
self.link_flags += ['-lstdc++']
|
self.link_flags += ['-lstdc++']
|
||||||
@ -356,7 +368,8 @@ class Configuration(object):
|
|||||||
else:
|
else:
|
||||||
self.lit_config.fatal(
|
self.lit_config.fatal(
|
||||||
'C++ ABI setting %s unsupported for tests' % cxx_abi)
|
'C++ ABI setting %s unsupported for tests' % cxx_abi)
|
||||||
# Configure extra libraries.
|
|
||||||
|
def configure_extra_library_flags(self):
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
self.link_flags += ['-lSystem']
|
self.link_flags += ['-lSystem']
|
||||||
elif sys.platform.startswith('linux'):
|
elif sys.platform.startswith('linux'):
|
||||||
@ -367,9 +380,6 @@ class Configuration(object):
|
|||||||
else:
|
else:
|
||||||
self.lit_config.fatal("unrecognized system: %r" % sys.platform)
|
self.lit_config.fatal("unrecognized system: %r" % sys.platform)
|
||||||
|
|
||||||
link_flags_str = self.get_lit_conf('link_flags', '')
|
|
||||||
self.link_flags += shlex.split(link_flags_str)
|
|
||||||
|
|
||||||
def configure_sanitizer(self):
|
def configure_sanitizer(self):
|
||||||
san = self.get_lit_conf('use_sanitizer', '').strip()
|
san = self.get_lit_conf('use_sanitizer', '').strip()
|
||||||
if san:
|
if san:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user