Skip to content

Commit 5de7371

Browse files
committed
[DWARFLinker] Move __debug_str to the last section
Signed-off-by: Peter Rong <[email protected]>
1 parent 24a4ad8 commit 5de7371

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

llvm/lib/DWARFLinker/Classic/DWARFLinker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3129,7 +3129,6 @@ Error DWARFLinker::link() {
31293129
// Emit everything that's global.
31303130
if (TheDwarfEmitter != nullptr) {
31313131
TheDwarfEmitter->emitAbbrevs(Abbreviations, Options.TargetDWARFVersion);
3132-
TheDwarfEmitter->emitStrings(DebugStrPool);
31333132
TheDwarfEmitter->emitStringOffsets(StringOffsetPool.getValues(),
31343133
Options.TargetDWARFVersion);
31353134
TheDwarfEmitter->emitLineStrings(DebugLineStrPool);
@@ -3150,6 +3149,7 @@ Error DWARFLinker::link() {
31503149
break;
31513150
}
31523151
}
3152+
TheDwarfEmitter->emitStrings(DebugStrPool);
31533153
}
31543154
};
31553155

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Check that the __debug_str section is last in the output
2+
3+
# RUN: rm -rf %t && mkdir %t
4+
# RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -o %t/swift-ast.dSYM -verbose -no-swiftmodule-timestamp
5+
# RUN: llvm-dwarfdump --show-section-sizes %t/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s
6+
7+
# This test verifies that the __debug_str section appears last in the section list.
8+
9+
# CHECK: SECTION
10+
# CHECK: __swift_ast
11+
# CHECK: __debug_abbrev
12+
# CHECK: __apple_namespac
13+
# CHECK: __apple_names
14+
# CHECK: __apple_types
15+
# CHECK: __apple_objc
16+
# CHECK-NOT: __apple
17+
# CHECK: __debug_str

0 commit comments

Comments
 (0)