[PATCH] D126936: [compiler-rt] Handle target and sysroot flags in tests
Petr Hosek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 2 18:37:21 PDT 2022
phosek created this revision.
phosek added reviewers: vitalybuka, yln, delcypher.
Herald added subscribers: Enna1, dberris.
Herald added a project: All.
phosek requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
Pass the target and sysroot flags from the build to lit and make sure
they are included in the test cflags.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126936
Files:
compiler-rt/test/lit.common.cfg.py
compiler-rt/test/lit.common.configured.in
Index: compiler-rt/test/lit.common.configured.in
===================================================================
--- compiler-rt/test/lit.common.configured.in
+++ compiler-rt/test/lit.common.configured.in
@@ -8,6 +8,8 @@
# Generic config options for all compiler-rt lit tests.
set_default("target_triple", "@COMPILER_RT_DEFAULT_TARGET_TRIPLE@")
set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_CFLAGS@")
+set_default("sysroot", "@CMAKE_SYSROOT@")
+set_default("osx_sysroot", "@CMAKE_OSX_SYSROOT@")
set_default("host_arch", "@HOST_ARCH@")
set_default("target_arch", "@COMPILER_RT_DEFAULT_TARGET_ARCH@")
set_default("host_os", "@HOST_OS@")
Index: compiler-rt/test/lit.common.cfg.py
===================================================================
--- compiler-rt/test/lit.common.cfg.py
+++ compiler-rt/test/lit.common.cfg.py
@@ -691,9 +691,19 @@
# Propagate the LLD/LTO into the clang config option, so nothing else is needed.
run_wrapper = []
-target_cflags = [getattr(config, 'target_cflags', None)]
+target_cflags = []
extra_cflags = []
+# Handle target triple and sysroot.
+if config.target_triple:
+ extra_cflags += ["--target=%s" % config.target_triple]
+if config.sysroot:
+ extra_cflags += ["--sysroot=%s" % config.sysroot]
+if config.osx_sysroot:
+ extra_cflags += ["-isysroot %s" % config.osx_sysroot]
+
+target_cflags.append(getattr(config, 'target_cflags', None))
+
if config.use_lto and config.lto_supported:
extra_cflags += config.lto_flags
elif config.use_lto and (not config.lto_supported):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126936.433934.patch
Type: text/x-patch
Size: 1541 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220603/1af7de1c/attachment.bin>
More information about the llvm-commits
mailing list