Skip to content

[lldb] Disable shell tests affected by ld_new bug #84246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Mar 6, 2024

Equivalent to the changes made in #83941, except to support shell tests.

@llvmbot llvmbot added the lldb label Mar 6, 2024
@kastiglione kastiglione requested a review from bulbazord March 6, 2024 22:24
@llvmbot
Copy link
Member

llvmbot commented Mar 6, 2024

@llvm/pr-subscribers-lldb

Author: Dave Lee (kastiglione)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/84246.diff

3 Files Affected:

  • (modified) lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test (+1-1)
  • (modified) lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test (+1-1)
  • (modified) lldb/test/Shell/lit.cfg.py (+12)
diff --git a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
index 3df9906394f432..783bfd45c4669a 100644
--- a/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
+++ b/lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test
@@ -1,7 +1,7 @@
 # Test handing of dwarf expressions specifying the location of registers, if
 # those expressions refer to the frame's CFA value.
 
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 # REQUIRES: target-x86_64, native
 
 # RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t
diff --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index 682b0e5332b1c5..a2b5ae8a9e3e5f 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -2,7 +2,7 @@
 # points to non-executable memory.
 
 # REQUIRES: target-x86_64
-# UNSUPPORTED: system-windows
+# UNSUPPORTED: system-windows, ld64-tls-bug
 
 # RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp %p/Inputs/thread-step-out-ret-addr-check.s -o %t
 # RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index d75c1f532e147f..6d41dc7d8d7325 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -1,5 +1,6 @@
 # -*- Python -*-
 
+import json
 import os
 import platform
 import re
@@ -179,3 +180,14 @@ def calculate_arch_features(arch_string):
 
 if "LD_PRELOAD" in os.environ:
     config.available_features.add("ld_preload-present")
+
+# Determine if a specific version of Xcode's linker contains a TLS bug. We want
+# to skip TLS tests if they contain this bug.
+try:
+    raw_version_details = subprocess.check_output(("xcrun", "ld", "-version_details"))
+    version_details = json.loads(raw_version_details)
+    version = version_details.get("version", "0")
+    if 1000 <= float(version) <= 1109:
+        config.available_features.add("ld64-tls-bug")
+except:
+    pass

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@bulbazord bulbazord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking care of that!

@JDevlieghere
Copy link
Member

I was just wondering, is this actually the TLS bug? I looked at the test and I don't see it doing anything with thread local storage. This might be another "new ld" bug. Maybe the feature should be called ld-prime-bug?

@kastiglione
Copy link
Contributor Author

Called it ld_new-bug. If it's not the TLS bug, I wonder if the version range is correct.

@kastiglione kastiglione changed the title [lldb] Disable shell tests affected by ld64 bug [lldb] Disable shell tests affected by ld_new bug Mar 7, 2024
@bulbazord
Copy link
Member

Called it ld_new-bug. If it's not the TLS bug, I wonder if the version range is correct.

The TLS bug in the new linker is explicitly from versions 1000 to 1109. If this isn't related to TLS, we'll need to confirm with the linker folks on our side.

@kastiglione
Copy link
Contributor Author

I think this should be merged, and if either end of the version range proves to be too limited, we can increase the range.

raw_version_details = subprocess.check_output(("xcrun", "ld", "-version_details"))
version_details = json.loads(raw_version_details)
version = version_details.get("version", "0")
if 1000 <= float(version) <= 1109:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

float will be insufficient, this will need to handle versions such as 1100.1.1

@JDevlieghere
Copy link
Member

LGTM with the check behind if platform.system() == "Darwin".

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@kastiglione kastiglione merged commit ecf7db8 into llvm:main Mar 7, 2024
@kastiglione kastiglione deleted the lldb-Disable-shell-tests-affected-by-ld64-bug branch March 7, 2024 20:55
kastiglione added a commit to swiftlang/llvm-project that referenced this pull request Apr 24, 2024
Equivalent to the changes made in llvm#83941,
except to support shell tests.

(cherry picked from commit ecf7db8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants