Skip to content

Commit c384fcd

Browse files
committed
[lld] Partially revert "Always emit symbol table when dwarf section exists in COFF"
This reverts part of commit 44363f2. Fixup for NO symbol table test has been reserved. Reviewed By: wxiao3 Differential Revision: https://reviews.llvm.org/D151417
1 parent af55b0d commit c384fcd

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

lld/COFF/Writer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,9 +1266,7 @@ void Writer::createSymbolAndStringTable() {
12661266
// solution where discardable sections have long names preserved and
12671267
// non-discardable sections have their names truncated, to ensure that any
12681268
// section which is mapped at runtime also has its name mapped at runtime.
1269-
bool HasDwarfSection = false;
12701269
for (OutputSection *sec : ctx.outputSections) {
1271-
HasDwarfSection |= sec->name.startswith(".debug_");
12721270
if (sec->name.size() <= COFF::NameSize)
12731271
continue;
12741272
if ((sec->header.Characteristics & IMAGE_SCN_MEM_DISCARDABLE) == 0)
@@ -1281,7 +1279,7 @@ void Writer::createSymbolAndStringTable() {
12811279
sec->setStringTableOff(addEntryToStringTable(sec->name));
12821280
}
12831281

1284-
if (ctx.config.debugDwarf || ctx.config.debugSymtab || HasDwarfSection) {
1282+
if (ctx.config.debugDwarf || ctx.config.debugSymtab) {
12851283
for (ObjFile *file : ctx.objFileInstances) {
12861284
for (Symbol *b : file->getSymbols()) {
12871285
auto *d = dyn_cast_or_null<Defined>(b);

lld/test/COFF/symtab.test

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
# RUN: lld-link /debug /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
1010
# 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
1311

1412
# CHECK: Symbols [
1513
# CHECK-NEXT: Symbol {
@@ -144,10 +142,6 @@ sections:
144142
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
145143
Alignment: 4
146144
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
151145
symbols:
152146
- Name: "@comp.id"
153147
Value: 10394907

0 commit comments

Comments
 (0)