[llvm-branch-commits] [compiler-rt] deec343 - [compiler-rt] Allow appending to 'target_cflags' value from lit_config.

Hafiz Abid Qadeer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Dec 8 03:54:25 PST 2020


Author: Hafiz Abid Qadeer
Date: 2020-12-08T11:46:36Z
New Revision: deec343bfd85d7c78fb0d8e251e63f372767297d

URL: https://github.com/llvm/llvm-project/commit/deec343bfd85d7c78fb0d8e251e63f372767297d
DIFF: https://github.com/llvm/llvm-project/commit/deec343bfd85d7c78fb0d8e251e63f372767297d.diff

LOG: [compiler-rt] Allow appending to 'target_cflags' value from lit_config.

This patch is similar to D84708. When testing compiler-rt on different
baremetal targets, it helps to have the ability to pass some more parameters
at test time that allows you to build the test executable for a
given target. For an example, you may need a different linker command
file for different targets.

This patch will allows to do things like

$ llvm-lit --param=append_target_cflags="-T simulator.ld"
or
$ llvm-lit --param=append_target_cflags="-T hardware.ld"

In this way, you can run tests on different targets without having to run
cmake again.

Reviewed By: delcypher

Differential Revision: https://reviews.llvm.org/D91783

Added: 
    

Modified: 
    compiler-rt/test/lit.common.cfg.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 889e29341ee2..e2de463f85c0 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -582,5 +582,11 @@ def is_windows_lto_supported():
 elif config.use_lld and (not config.has_lld):
   config.unsupported = True
 
+# Append any extra flags passed in lit_config
+append_target_cflags = lit_config.params.get('append_target_cflags', None)
+if append_target_cflags:
+  lit_config.note('Appending to extra_cflags: "{}"'.format(append_target_cflags))
+  extra_cflags += [append_target_cflags]
+
 config.clang = " " + " ".join(run_wrapper + [config.compile_wrapper, config.clang]) + " "
 config.target_cflags = " " + " ".join(target_cflags + extra_cflags) + " "


        


More information about the llvm-branch-commits mailing list