File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1266,7 +1266,9 @@ void Writer::createSymbolAndStringTable() {
1266
1266
// solution where discardable sections have long names preserved and
1267
1267
// non-discardable sections have their names truncated, to ensure that any
1268
1268
// section which is mapped at runtime also has its name mapped at runtime.
1269
+ bool HasDwarfSection = false ;
1269
1270
for (OutputSection *sec : ctx.outputSections ) {
1271
+ HasDwarfSection |= sec->name .startswith (" .debug_" );
1270
1272
if (sec->name .size () <= COFF::NameSize)
1271
1273
continue ;
1272
1274
if ((sec->header .Characteristics & IMAGE_SCN_MEM_DISCARDABLE) == 0 )
@@ -1279,7 +1281,7 @@ void Writer::createSymbolAndStringTable() {
1279
1281
sec->setStringTableOff (addEntryToStringTable (sec->name ));
1280
1282
}
1281
1283
1282
- if (ctx.config .debugDwarf || ctx.config .debugSymtab ) {
1284
+ if (ctx.config .debugDwarf || ctx.config .debugSymtab || HasDwarfSection ) {
1283
1285
for (ObjFile *file : ctx.objFileInstances ) {
1284
1286
for (Symbol *b : file->getSymbols ()) {
1285
1287
auto *d = dyn_cast_or_null<Defined>(b);
Original file line number Diff line number Diff line change 8
8
9
9
# RUN: lld-link /debug /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
10
10
# RUN: llvm-readobj --symbols %t.exe | FileCheck -check-prefix=NO %s
11
+ # RUN: lld-link /debug /merge:.blank=.debug_info /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
12
+ # RUN: llvm-readobj --symbols %t.exe | FileCheck %s
11
13
12
14
# CHECK: Symbols [
13
15
# CHECK-NEXT: Symbol {
84
86
# CHECK-NEXT: }
85
87
# CHECK-NEXT: ]
86
88
87
- # NO: Symbols [
89
+ # NO: Symbols [
90
+ # NO-NEXT: ]
88
91
89
92
--- !COFF
90
93
header:
@@ -141,6 +144,10 @@ sections:
141
144
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
142
145
Alignment: 4
143
146
SectionData: 48656C6C6F0048656C6C6F20576F726C6400
147
+ - Name: .blank
148
+ Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
149
+ Alignment: 1
150
+ SectionData: 0000
144
151
symbols:
145
152
- Name: "@comp.id"
146
153
Value: 10394907
You can’t perform that action at this time.
0 commit comments