[compiler-rt] [Darwin] Fix lit substitution for mtargetos flag on darwin devices (PR #96953)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 12:15:42 PDT 2024


https://github.com/thetruestblue created https://github.com/llvm/llvm-project/pull/96953

Changes substitution logic to appropriately parse either format for min deployment flag: -mtargetos={platform}{major}.{min){?-simulator} or -m{platform}-{sim}-version-min={major}.{min} as the apple_platform_min_deployment_target_flag.

rdar://130022065


>From 658dbcac46205a063b6b8ddf77b86e9710c7b4f7 Mon Sep 17 00:00:00 2001
From: Blue Gaston <bgaston2 at apple.com>
Date: Wed, 26 Jun 2024 16:19:27 -0700
Subject: [PATCH] [Darwin] Fix lit substitution for mtargetos flag on darwin
 devices

Changes substitution logic to appropriately parse either format for min deployment flag: -mtargetos={platform}{major}.{min){?-simulator} or -m{platform}-{sim}-version-min={major}.{min} as the apple_platform_min_deployment_target_flag.

rdar://130022065
---
 compiler-rt/test/lit.common.cfg.py | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index 64b9a9d025e7b..70bf43e2fac59 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -586,21 +586,18 @@ 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)
-        if "mtargetos" in flag:
+        apple_device = ""
+        sim = ""
+        if "target" in flag:
+            apple_device = config.apple_platform.split("sim")[0]
             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),
-                )
+
+        config.substitutions.append(
+            (
+                "%%min_macos_deployment_target=%s.%s" % vers,
+                "{}={}{}.{}{}".format(flag, apple_device, major, minor, sim),
             )
+        )
 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