Skip to content

Commit 84658fb

Browse files
Revert "[PS4/PS5][Driver][DWARF] Always emit .debug_aranges for SCE t… (#99711)
…uning (#99629)" This reverts commit 22eb290.
1 parent 9e74f66 commit 84658fb

File tree

8 files changed

+30
-57
lines changed

8 files changed

+30
-57
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4659,8 +4659,11 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
46594659

46604660
// -gdwarf-aranges turns on the emission of the aranges section in the
46614661
// backend.
4662-
if (const Arg *A = Args.getLastArg(options::OPT_gdwarf_aranges);
4663-
A && checkDebugInfoOption(A, Args, D, TC)) {
4662+
// Always enabled for SCE tuning.
4663+
bool NeedAranges = DebuggerTuning == llvm::DebuggerKind::SCE;
4664+
if (const Arg *A = Args.getLastArg(options::OPT_gdwarf_aranges))
4665+
NeedAranges = checkDebugInfoOption(A, Args, D, TC) || NeedAranges;
4666+
if (NeedAranges) {
46644667
CmdArgs.push_back("-mllvm");
46654668
CmdArgs.push_back("-generate-arange-section");
46664669
}

clang/lib/Driver/ToolChains/PS4CPU.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ void tools::PS4cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
162162
};
163163

164164
if (UseLTO) {
165+
// We default to creating the arange section, but LTO does not. Enable it
166+
// here.
167+
AddCodeGenFlag("-generate-arange-section");
168+
165169
// This tells LTO to perform JustMyCode instrumentation.
166170
if (UseJMC)
167171
AddCodeGenFlag("-enable-jmc-instrument");
@@ -268,6 +272,10 @@ void tools::PS5cpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
268272
};
269273

270274
if (UseLTO) {
275+
// We default to creating the arange section, but LTO does not. Enable it
276+
// here.
277+
AddCodeGenFlag("-generate-arange-section");
278+
271279
// This tells LTO to perform JustMyCode instrumentation.
272280
if (UseJMC)
273281
AddCodeGenFlag("-enable-jmc-instrument");

clang/test/Driver/debug-options.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,28 +118,27 @@
118118
// RUN: %clang_cl -### -c -Z7 -target x86_64-windows-msvc -- %s 2>&1 \
119119
// RUN: | FileCheck -check-prefix=G_NOTUNING %s
120120

121-
// On the PS4/PS5, -g defaults to -gno-column-info. We default to always
122-
// generating the arange section, but keyed off SCE DebuggerTuning being in
123-
// play during codegen, instead of -generate-arange-section.
121+
// On the PS4/PS5, -g defaults to -gno-column-info, and we always generate the
122+
// arange section.
124123
// RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \
125124
// RUN: | FileCheck -check-prefix=NOG_PS %s
126125
// RUN: %clang -### -c %s -target x86_64-sie-ps5 2>&1 \
127126
// RUN: | FileCheck -check-prefix=NOG_PS %s
128127
/// PS4 will stay on v4 even if the generic default version changes.
129128
// RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \
130-
// RUN: | FileCheck -check-prefixes=G_DWARF4,G_SCE,NOCI,FWD_TMPL_PARAMS %s
129+
// RUN: | FileCheck -check-prefixes=G_DWARF4,GARANGE,G_SCE,NOCI,FWD_TMPL_PARAMS %s
131130
// RUN: %clang -### -c %s -g -target x86_64-sie-ps5 2>&1 \
132-
// RUN: | FileCheck -check-prefixes=G_DWARF5,G_SCE,NOCI,FWD_TMPL_PARAMS %s
131+
// RUN: | FileCheck -check-prefixes=G_DWARF5,GARANGE,G_SCE,NOCI,FWD_TMPL_PARAMS %s
133132
// RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \
134133
// RUN: | FileCheck -check-prefix=CI %s
135134
// RUN: %clang -### -c %s -gsce -target x86_64-unknown-linux 2>&1 \
136135
// RUN: | FileCheck -check-prefix=NOCI %s
137136
// RUN: %clang -### %s -g -flto=thin -target x86_64-scei-ps4 2>&1 \
138-
// RUN: | FileCheck -check-prefix=LDGARANGE %s
137+
// RUN: | FileCheck -check-prefix=SNLDTLTOGARANGE %s
139138
// RUN: %clang -### %s -g -flto=full -target x86_64-scei-ps4 2>&1 \
140-
// RUN: | FileCheck -check-prefix=LDGARANGE %s
139+
// RUN: | FileCheck -check-prefix=SNLDFLTOGARANGE %s
141140
// RUN: %clang -### %s -g -flto -target x86_64-scei-ps5 2>&1 \
142-
// RUN: | FileCheck -check-prefix=LDGARANGE %s
141+
// RUN: | FileCheck -check-prefix=LLDGARANGE %s
143142
// RUN: %clang -### %s -g -target x86_64-scei-ps5 2>&1 \
144143
// RUN: | FileCheck -check-prefix=LDGARANGE %s
145144

@@ -322,7 +321,8 @@
322321
//
323322
// NOG_PS: "-cc1"
324323
// NOG_PS-NOT: "-dwarf-version=
325-
// NOG_PS-NOT: "-generate-arange-section"
324+
// NOG_PS: "-generate-arange-section"
325+
// NOG_PS-NOT: "-dwarf-version=
326326
//
327327
// G_ERR: error: unknown argument:
328328
//
@@ -402,7 +402,8 @@
402402
//
403403

404404
// LDGARANGE: {{".*ld.*"}} {{.*}}
405-
// LDGARANGE-NOT: -generate-arange-section"
405+
// LDGARANGE-NOT: "-plugin-opt=-generate-arange-section"
406+
// LLDGARANGE: {{".*lld.*"}} {{.*}} "-plugin-opt=-generate-arange-section"
406407
// SNLDTLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-thin-debug-options= -generate-arange-section"
407408
// SNLDFLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-debug-options= -generate-arange-section"
408409

clang/test/Driver/lto-jobs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=thin -flto-jobs=5 2> %t
1212
// RUN: FileCheck -check-prefix=CHECK-PS4-LINK-THIN-JOBS-ACTION < %t %s
1313
//
14-
// CHECK-PS4-LINK-THIN-JOBS-ACTION: "-lto-thin-debug-options= -threads=5"
14+
// CHECK-PS4-LINK-THIN-JOBS-ACTION: "-lto-thin-debug-options= -generate-arange-section -threads=5"
1515

1616
// RUN: %clang --target=x86_64-apple-darwin13.3.0 -### %s -flto=thin -flto-jobs=5 2> %t
1717
// RUN: FileCheck -check-prefix=CHECK-LINK-THIN-JOBS2-ACTION < %t %s

clang/test/Driver/ps4-linker.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// RUN: %clang --target=x86_64-scei-ps4 -flto=full -fjmc %s -### 2>&1 | FileCheck --check-prefixes=CHECK-FULL-LTO,CHECK-LIB %s
66

77
// CHECK-NOT: -enable-jmc-instrument
8-
// CHECK-THIN-LTO: "-lto-thin-debug-options= -enable-jmc-instrument"
9-
// CHECK-FULL-LTO: "-lto-debug-options= -enable-jmc-instrument"
8+
// CHECK-THIN-LTO: "-lto-thin-debug-options= -generate-arange-section -enable-jmc-instrument"
9+
// CHECK-FULL-LTO: "-lto-debug-options= -generate-arange-section -enable-jmc-instrument"
1010

1111
// Check the default library name.
1212
// CHECK-LIB: "--whole-archive" "-lSceDbgJmc" "--no-whole-archive"
@@ -16,5 +16,5 @@
1616
// RUN: %clang --target=x86_64-scei-ps4 -flto=thin -fcrash-diagnostics-dir=mydumps %s -### 2>&1 | FileCheck --check-prefixes=CHECK-DIAG-THIN-LTO %s
1717
// RUN: %clang --target=x86_64-scei-ps4 -flto=full -fcrash-diagnostics-dir=mydumps %s -### 2>&1 | FileCheck --check-prefixes=CHECK-DIAG-FULL-LTO %s
1818

19-
// CHECK-DIAG-THIN-LTO: "-lto-thin-debug-options= -crash-diagnostics-dir=mydumps"
20-
// CHECK-DIAG-FULL-LTO: "-lto-debug-options= -crash-diagnostics-dir=mydumps"
19+
// CHECK-DIAG-THIN-LTO: "-lto-thin-debug-options= -generate-arange-section -crash-diagnostics-dir=mydumps"
20+
// CHECK-DIAG-FULL-LTO: "-lto-debug-options= -generate-arange-section -crash-diagnostics-dir=mydumps"

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A)
354354

355355
UseLocSection = !TT.isNVPTX();
356356

357-
// Always emit .debug_aranges for SCE tuning.
358-
UseARangesSection = GenerateARangeSection || tuneForSCE();
359-
360357
HasAppleExtensionAttributes = tuneForLLDB();
361358

362359
// Handle split DWARF.
@@ -1453,7 +1450,7 @@ void DwarfDebug::endModule() {
14531450
emitDebugInfo();
14541451

14551452
// Emit info into a debug aranges section.
1456-
if (UseARangesSection)
1453+
if (GenerateARangeSection)
14571454
emitDebugARanges();
14581455

14591456
// Emit info into a debug ranges section.

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,6 @@ class DwarfDebug : public DebugHandlerBase {
435435
///Allow emission of the .debug_loc section.
436436
bool UseLocSection = true;
437437

438-
/// Allow emission of .debug_aranges section
439-
bool UseARangesSection = false;
440-
441438
/// Generate DWARF v4 type units.
442439
bool GenerateTypeUnits;
443440

llvm/test/DebugInfo/X86/debug-aranges-sce-tuning.ll

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)