Skip to content

Commit 1bd3ab7

Browse files
Merge pull request #8887 from adrian-prantl/cherry-pick-swift-release-6.0-Bump-the-DWARF-version-number-to-5-on-Darwin.-95164
[Cherry-pick into swift/release/6.0] Bump the DWARF version number to 5 on Darwin. (llvm#95164)
2 parents d1048cb + ce11ee9 commit 1bd3ab7

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

clang/lib/Driver/ToolChains/Darwin.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,16 @@ unsigned DarwinClang::GetDefaultDwarfVersion() const {
14441444
if ((isTargetMacOSBased() && isMacosxVersionLT(10, 11)) ||
14451445
(isTargetIOSBased() && isIPhoneOSVersionLT(9)))
14461446
return 2;
1447-
return 4;
1447+
// Default to use DWARF 4 on OS X 10.11 - macOS 14 / iOS 9 - iOS 17.
1448+
if ((isTargetMacOSBased() && isMacosxVersionLT(15)) ||
1449+
(isTargetIOSBased() && isIPhoneOSVersionLT(18)) ||
1450+
(isTargetWatchOSBased() && TargetVersion < llvm::VersionTuple(11)) ||
1451+
(isTargetXROS() && TargetVersion < llvm::VersionTuple(2)) ||
1452+
(isTargetDriverKit() && TargetVersion < llvm::VersionTuple(24)) ||
1453+
(isTargetMacOSBased() &&
1454+
TargetVersion.empty())) // apple-darwin, no version.
1455+
return 4;
1456+
return 5;
14481457
}
14491458

14501459
void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,

clang/test/Driver/debug-options.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,32 @@
6969
// RUN: %clang -### -c -g %s -target x86_64-apple-driverkit19.0 2>&1 \
7070
// RUN: | FileCheck -check-prefix=G_STANDALONE \
7171
// RUN: -check-prefix=G_DWARF4 %s
72-
// RUN: %clang -### -c -fsave-optimization-record %s \
72+
// RUN: %clang -### -c -g %s -target x86_64-apple-macosx15 2>&1 \
73+
// RUN: | FileCheck -check-prefix=G_STANDALONE \
74+
// RUN: -check-prefix=G_DWARF5 %s
75+
// RUN: %clang -### -c -g %s -target arm64-apple-ios17.0 2>&1 \
76+
// RUN: | FileCheck -check-prefix=G_STANDALONE \
77+
// RUN: -check-prefix=G_DWARF4 %s
78+
// RUN: %clang -### -c -g %s -target arm64-apple-ios18.0 2>&1 \
79+
// RUN: | FileCheck -check-prefix=G_STANDALONE \
80+
// RUN: -check-prefix=G_DWARF5 %s
81+
// RUN: %clang -### -c -g %s -target arm64_32-apple-watchos11 2>&1 \
82+
// RUN: | FileCheck -check-prefix=G_STANDALONE \
83+
// RUN: -check-prefix=G_DWARF5 %s
84+
// RUN: %clang -### -c -g %s -target arm64-apple-tvos18.0 2>&1 \
85+
// RUN: | FileCheck -check-prefix=G_STANDALONE \
86+
// RUN: -check-prefix=G_DWARF5 %s
87+
// RUN: %clang -### -c -g %s -target x86_64-apple-driverkit24.0 2>&1 \
88+
// RUN: | FileCheck -check-prefix=G_STANDALONE \
89+
// RUN: -check-prefix=G_DWARF5 %s
90+
// RUN: %clang -### -c -g %s -target arm64-apple-xros1 2>&1 \
91+
// RUN: | FileCheck -check-prefix=G_STANDALONE \
92+
// RUN: -check-prefix=G_DWARF4 %s
93+
// RUN: %clang -### -c -g %s -target arm64-apple-xros2 2>&1 \
94+
// RUN: | FileCheck -check-prefix=G_STANDALONE \
95+
// RUN: -check-prefix=G_DWARF5 %s
96+
//
97+
// RUN: %clang -### -c -fsave-optimization-record %s \
7398
// RUN: -target x86_64-apple-darwin 2>&1 \
7499
// RUN: | FileCheck -check-prefix=GLTO_ONLY %s
75100
// RUN: %clang -### -c -g -fsave-optimization-record %s \

0 commit comments

Comments
 (0)