diff options
author | Martin Storsjö <martin@martin.st> | 2020-10-22 21:33:10 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-02-26 00:10:48 +0200 |
commit | fb2e4f5401d3ec2507ac3b2c4f86d4bfa07c01ec (patch) | |
tree | 74faa696d730975c7523b777a871bc6297f697e8 /libcxx | |
parent | 72fe14d40a527465deb76c9b2241297635fd45bf (diff) | |
download | llvm-fb2e4f5401d3ec2507ac3b2c4f86d4bfa07c01ec.zip llvm-fb2e4f5401d3ec2507ac3b2c4f86d4bfa07c01ec.tar.gz llvm-fb2e4f5401d3ec2507ac3b2c4f86d4bfa07c01ec.tar.bz2 |
[libcxx] [test] Add a MinGW target
This can't easily be autodetected (unless LIBCXX_TARGET_TRIPLE is
specified, or unless we query what the compiler's default target is,
which only is supported by clang), but can be chosen manually via
LIBCXX_TARGET_INFO.
This chooses mingw style lib naming, and uses -nostdlibc++ instead
of -nodefaultlib -nostdlib (as the latter requires specifying a lot of
details manually - this is done in the cmake config though).
Differential Revision: https://reviews.llvm.org/D97294
Diffstat (limited to 'libcxx')
-rw-r--r-- | libcxx/utils/libcxx/test/config.py | 9 | ||||
-rw-r--r-- | libcxx/utils/libcxx/test/target_info.py | 10 |
2 files changed, 16 insertions, 3 deletions
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py index 8e40a79..ab1f1b8 100644 --- a/libcxx/utils/libcxx/test/config.py +++ b/libcxx/utils/libcxx/test/config.py @@ -109,7 +109,7 @@ class Configuration(object): def make_static_lib_name(self, name): """Return the full filename for the specified library name""" - if self.target_info.is_windows(): + if self.target_info.is_windows() and not self.target_info.is_mingw(): assert name == 'c++' # Only allow libc++ to use this function for now. return 'lib' + name + '.lib' else: @@ -382,9 +382,12 @@ class Configuration(object): # Configure libraries if self.cxx_stdlib_under_test == 'libc++': - self.cxx.link_flags += ['-nodefaultlibs'] + if self.target_info.is_mingw(): + self.cxx.link_flags += ['-nostdlib++'] + else: + self.cxx.link_flags += ['-nodefaultlibs'] # FIXME: Handle MSVCRT as part of the ABI library handling. - if self.target_info.is_windows(): + if self.target_info.is_windows() and not self.target_info.is_mingw(): self.cxx.link_flags += ['-nostdlib'] self.configure_link_flags_cxx_library() self.configure_link_flags_abi_library() diff --git a/libcxx/utils/libcxx/test/target_info.py b/libcxx/utils/libcxx/test/target_info.py index 130d560..9c7a73b 100644 --- a/libcxx/utils/libcxx/test/target_info.py +++ b/libcxx/utils/libcxx/test/target_info.py @@ -27,6 +27,9 @@ class DefaultTargetInfo(object): def is_windows(self): return self.platform() == 'win32' + def is_mingw(self): + return False + def is_darwin(self): return self.platform() == 'darwin' @@ -184,6 +187,13 @@ class WindowsLocalTI(DefaultTargetInfo): def __init__(self, full_config): super(WindowsLocalTI, self).__init__(full_config) +class MingwLocalTI(WindowsLocalTI): + def __init__(self, full_config): + super(MingwLocalTI, self).__init__(full_config) + + def is_mingw(self): + return True + def make_target_info(full_config): default = "libcxx.test.target_info.LocalTI" info_str = full_config.get_lit_conf('target_info', default) |