[Lldb-commits] [lldb] [lldb] Add ability to detect darwin host linker version to xfail tests (PR #83941)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 5 07:16:44 PST 2024


================
@@ -333,3 +335,41 @@ def expectedCompiler(compilers):
             return True
 
     return False
+
+
+# This is a helper function to determine if a specific version of Xcode's linker
+# contains a TLS bug. We want to skip TLS tests if they contain this bug, but
+# adding a linker/linker_version conditions to a decorator is challenging due to
+# the number of ways linkers can enter the build process.
+def darwinLinkerHasTLSBug():
+    """Returns true iff a test is running on a darwin platform and the host linker is between versions 1000 and 1109."""
+    darwin_platforms = lldbplatform.translate(lldbplatform.darwin_all)
+    if getPlatform() not in darwin_platforms:
+        return False
+
+    linker_path = (
+        subprocess.check_output(["xcrun", "--find", "ld"]).rstrip().decode("utf-8")
+    )
+    if not is_exe(linker_path):
+        return False
+
+    raw_linker_info = (
+        subprocess.check_output([linker_path, "-version_details"])
+        .rstrip()
+        .decode("utf-8")
+    )
+    parsed_linker_info = json.loads(raw_linker_info)
+    if "version" not in parsed_linker_info:
+        return False
+
+    raw_version = parsed_linker_info["version"]
+    version = None
+    try:
+        version = int(raw_version)
----------------
kastiglione wrote:

this this guaranteed to always be an integer? Note that `ld -ld_classic -version_details` has a version of "954.7" on my machine. Were there any releases with decimals in the range that has the bug?

https://github.com/llvm/llvm-project/pull/83941


More information about the lldb-commits mailing list