[libcxx-commits] [libcxx] fb2e4f5 - [libcxx] [test] Add a MinGW target
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 25 14:11:12 PST 2021
Author: Martin Storsjö
Date: 2021-02-26T00:10:48+02:00
New Revision: fb2e4f5401d3ec2507ac3b2c4f86d4bfa07c01ec
URL: https://github.com/llvm/llvm-project/commit/fb2e4f5401d3ec2507ac3b2c4f86d4bfa07c01ec
DIFF: https://github.com/llvm/llvm-project/commit/fb2e4f5401d3ec2507ac3b2c4f86d4bfa07c01ec.diff
LOG: [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
Added:
Modified:
libcxx/utils/libcxx/test/config.py
libcxx/utils/libcxx/test/target_info.py
Removed:
################################################################################
diff --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 8e40a794a87d..ab1f1b836c9a 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -109,7 +109,7 @@ def check_value(value, var_name):
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 @@ def configure_link_flags(self):
# 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 130d5600ed17..9c7a73ba8788 100644
--- a/libcxx/utils/libcxx/test/target_info.py
+++ b/libcxx/utils/libcxx/test/target_info.py
@@ -27,6 +27,9 @@ def platform(self):
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)
More information about the libcxx-commits
mailing list