Skip to content

Commit 8000b5d

Browse files
author
git apple-llvm automerger
committed
Merge commit '04bbe1bb0753' from swift/release/6.0 into stable/20230725
2 parents dfc3507 + 04bbe1b commit 8000b5d

File tree

5 files changed

+43
-7
lines changed

5 files changed

+43
-7
lines changed

lldb/packages/Python/lldbsuite/test/lldbplatformutil.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
# System modules
77
import itertools
8+
import json
89
import re
910
import subprocess
1011
import sys
@@ -18,6 +19,7 @@
1819
from . import lldbtest_config
1920
import lldbsuite.test.lldbplatform as lldbplatform
2021
from lldbsuite.test.builders import get_builder
22+
from lldbsuite.test.lldbutil import is_exe
2123

2224

2325
def check_first_register_readable(test_case):
@@ -332,4 +334,26 @@ def expectedCompiler(compilers):
332334
if compiler in getCompiler():
333335
return True
334336

337+
# This is a helper function to determine if a specific version of Xcode's linker
338+
# contains a TLS bug. We want to skip TLS tests if they contain this bug, but
339+
# adding a linker/linker_version conditions to a decorator is challenging due to
340+
# the number of ways linkers can enter the build process.
341+
def xcode15LinkerBug(_self=None):
342+
"""Returns true iff a test is running on a darwin platform and the host linker is between versions 1000 and 1109."""
343+
darwin_platforms = lldbplatform.translate(lldbplatform.darwin_all)
344+
if getPlatform() not in darwin_platforms:
345+
return False
346+
347+
try:
348+
raw_version_details = subprocess.check_output(
349+
("xcrun", "ld", "-version_details")
350+
)
351+
version_details = json.loads(raw_version_details)
352+
version = version_details.get("version", "0")
353+
version_tuple = tuple(int(x) for x in version.split("."))
354+
if (1000,) <= version_tuple <= (1109,):
355+
return True
356+
except:
357+
pass
358+
335359
return False

lldb/test/API/lang/c/tls_globals/TestTlsGlobals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def setUp(self):
4242
bugnumber="llvm.org/pr28392",
4343
oslist=no_match(lldbplatformutil.getDarwinOSTriples()),
4444
)
45-
@expectedFailureDarwin("rdar://120676969")
45+
@expectedFailureIfFn(lldbplatformutil.xcode15LinkerBug)
4646
def test(self):
4747
"""Test thread-local storage."""
4848
self.build()

lldb/test/Shell/Unwind/eh-frame-dwarf-unwind.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Test handing of dwarf expressions specifying the location of registers, if
22
# those expressions refer to the frame's CFA value.
33

4-
# UNSUPPORTED: system-windows
4+
# UNSUPPORTED: system-windows, ld_new-bug
55
# REQUIRES: target-x86_64, native
6-
# XFAIL: system-darwin
7-
# See: rdar://120797300
86

97
# RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/eh-frame-dwarf-unwind.s -o %t
108
# RUN: %lldb %t -s %s -o exit | FileCheck %s

lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
# points to non-executable memory.
33

44
# REQUIRES: target-x86_64
5-
# UNSUPPORTED: system-windows
6-
# XFAIL: system-darwin
7-
# See: rdar://120797300
5+
# UNSUPPORTED: system-windows, ld_new-bug
86

97
# RUN: %clang_host %p/Inputs/call-asm.c -x assembler-with-cpp %p/Inputs/thread-step-out-ret-addr-check.s -o %t
108
# RUN: not %lldb %t -s %s -b 2>&1 | FileCheck %s

lldb/test/Shell/lit.cfg.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- Python -*-
22

3+
import json
34
import os
45
import platform
56
import re
@@ -194,3 +195,18 @@ def calculate_arch_features(arch_string):
194195

195196
if "LD_PRELOAD" in os.environ:
196197
config.available_features.add("ld_preload-present")
198+
199+
# Determine if a specific version of Xcode's linker contains a bug. We want to
200+
# skip affected tests if they contain this bug.
201+
if platform.system() == "Darwin":
202+
try:
203+
raw_version_details = subprocess.check_output(
204+
("xcrun", "ld", "-version_details")
205+
)
206+
version_details = json.loads(raw_version_details)
207+
version = version_details.get("version", "0")
208+
version_tuple = tuple(int(x) for x in version.split("."))
209+
if (1000,) <= version_tuple <= (1109,):
210+
config.available_features.add("ld_new-bug")
211+
except:
212+
pass

0 commit comments

Comments
 (0)