[compiler-rt] a89982c - [Sanitizers][Darwin] Allows '-mtargetos' to used to set minimum deployment target.

Blue Gaston via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 11:25:57 PDT 2022


Author: Blue Gaston
Date: 2022-07-26T11:25:49-07:00
New Revision: a89982c40de41581bdef1e2088d22fdb16fd8404

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

LOG: [Sanitizers][Darwin] Allows '-mtargetos' to used to set minimum deployment target.

Currently, m{platform}-version-min is default flag used to set min deployment target within compilter-rt and sanitizers.
However, clang uses flags -target and -mtargetos for setting target triple and minimum deployment targets.
-mtargetos will be the preferred flag to set min version in the future and the
${platform}-version-min flag will not be used for future platforms.

This change allows darwin platforms to use either ${platform}-min-version or -mtargetos
without breaking lit test flags that allows for overriding the default min value in lit tests
Tests using flags: 'darwin_min_target_with_tls_support', 'min_macos_deployment_target'
will no longer fail if they use mtargetos instead of version-min.

rdar://81028225

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

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 62a73dd31396..c5a8420da14f 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -455,7 +455,11 @@ def get_macos_aligned_version(macos_vers):
   for vers in min_macos_deployment_target_substitutions:
     flag = config.apple_platform_min_deployment_target_flag
     major, minor = get_macos_aligned_version(vers)
-    config.substitutions.append( ('%%min_macos_deployment_target=%s.%s' % vers, '{}={}.{}'.format(flag, major, minor)) )
+    if 'mtargetos' in flag:
+      sim = '-simulator' if 'sim' in config.apple_platform else ''
+      config.substitutions.append( ('%%min_macos_deployment_target=%s.%s' % vers, '{}{}.{}{}'.format(flag, major, minor, sim)) )
+    else:
+      config.substitutions.append( ('%%min_macos_deployment_target=%s.%s' % vers, '{}={}.{}'.format(flag, major, minor)) )
 else:
   for vers in min_macos_deployment_target_substitutions:
     config.substitutions.append( ('%%min_macos_deployment_target=%s.%s' % vers, '') )


        


More information about the llvm-commits mailing list