File tree Expand file tree Collapse file tree 2 files changed +50
-4
lines changed Expand file tree Collapse file tree 2 files changed +50
-4
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,11 @@ template <class ELFT> class Writer {
93
93
} // anonymous namespace
94
94
95
95
StringRef elf::getOutputSectionName (StringRef Name) {
96
+ // ".zdebug_" is a prefix for ZLIB-compressed sections.
97
+ // Because we decompressed input sections, we want to remove 'z'.
98
+ if (Name.startswith (" .zdebug_" ))
99
+ return Saver.save (" ." + Name.substr (2 ));
100
+
96
101
if (Config->Relocatable )
97
102
return Name;
98
103
@@ -122,10 +127,6 @@ StringRef elf::getOutputSectionName(StringRef Name) {
122
127
if (Name == " COMMON" )
123
128
return " .bss" ;
124
129
125
- // ".zdebug_" is a prefix for ZLIB-compressed sections.
126
- // Because we decompressed input sections, we want to remove 'z'.
127
- if (Name.startswith (" .zdebug_" ))
128
- return Saver.save (" ." + Name.substr (2 ));
129
130
return Name;
130
131
}
131
132
Original file line number Diff line number Diff line change
1
+ # REQUIRES: zlib
2
+
3
+ # RUN: llvm-mc -compress-debug-sections=zlib-gnu -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
4
+ # RUN: llvm-readobj -sections %t1 | FileCheck -check-prefix=GNU %s
5
+ # GNU: Name: .zdebug_str
6
+
7
+ # RUN: ld.lld %t1 -o %t2 -r
8
+ # RUN: llvm-readobj -sections -section-data %t2 | FileCheck %s
9
+
10
+ ## Check we decompress section and remove ".z" prefix specific for zlib-gnu compression.
11
+ # CHECK: Section {
12
+ # CHECK: Index:
13
+ # CHECK: Name: .debug_str
14
+ # CHECK-NEXT: Type: SHT_PROGBITS
15
+ # CHECK-NEXT: Flags [
16
+ # CHECK-NEXT: SHF_MERGE
17
+ # CHECK-NEXT: SHF_STRINGS
18
+ # CHECK-NEXT: ]
19
+ # CHECK-NEXT: Address:
20
+ # CHECK-NEXT: Offset:
21
+ # CHECK-NEXT: Size:
22
+ # CHECK-NEXT: Link:
23
+ # CHECK-NEXT: Info:
24
+ # CHECK-NEXT: AddressAlignment: 1
25
+ # CHECK-NEXT: EntrySize: 1
26
+ # CHECK-NEXT: SectionData (
27
+ # CHECK-NEXT: 0000: {{.*}} |short unsigned i|
28
+ # CHECK-NEXT: 0010: {{.*}} |nt.unsigned int.|
29
+ # CHECK-NEXT: 0020: {{.*}} |long unsigned in|
30
+ # CHECK-NEXT: 0030: {{.*}} |t.char.unsigned |
31
+ # CHECK-NEXT: 0040: {{.*}} |char.|
32
+ # CHECK-NEXT: )
33
+ # CHECK-NEXT: }
34
+
35
+ .section .debug_str,"MS" ,@progbits ,1
36
+ .LASF2:
37
+ .string "short unsigned int"
38
+ .LASF3:
39
+ .string "unsigned int"
40
+ .LASF0:
41
+ .string "long unsigned int"
42
+ .LASF8:
43
+ .string "char"
44
+ .LASF1:
45
+ .string "unsigned char"
You can’t perform that action at this time.
0 commit comments