[lld] c384fcd - [lld] Partially revert "Always emit symbol table when dwarf section exists in COFF"
Haohai Wen via llvm-commits
llvm-commits at lists.llvm.org
Sun May 28 18:24:01 PDT 2023
Author: Haohai Wen
Date: 2023-05-29T09:23:51+08:00
New Revision: c384fcd3ea1dad782eaaea89b32fc33c0c3528b8
URL: https://github.com/llvm/llvm-project/commit/c384fcd3ea1dad782eaaea89b32fc33c0c3528b8
DIFF: https://github.com/llvm/llvm-project/commit/c384fcd3ea1dad782eaaea89b32fc33c0c3528b8.diff
LOG: [lld] Partially revert "Always emit symbol table when dwarf section exists in COFF"
This reverts part of commit 44363f2ff2736e4edf4a260f442b513ceac661fc.
Fixup for NO symbol table test has been reserved.
Reviewed By: wxiao3
Differential Revision: https://reviews.llvm.org/D151417
Added:
Modified:
lld/COFF/Writer.cpp
lld/test/COFF/symtab.test
Removed:
################################################################################
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index 256e914ef84b8..fe9fb18c7855b 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -1266,9 +1266,7 @@ void Writer::createSymbolAndStringTable() {
// solution where discardable sections have long names preserved and
// non-discardable sections have their names truncated, to ensure that any
// section which is mapped at runtime also has its name mapped at runtime.
- bool HasDwarfSection = false;
for (OutputSection *sec : ctx.outputSections) {
- HasDwarfSection |= sec->name.startswith(".debug_");
if (sec->name.size() <= COFF::NameSize)
continue;
if ((sec->header.Characteristics & IMAGE_SCN_MEM_DISCARDABLE) == 0)
@@ -1281,7 +1279,7 @@ void Writer::createSymbolAndStringTable() {
sec->setStringTableOff(addEntryToStringTable(sec->name));
}
- if (ctx.config.debugDwarf || ctx.config.debugSymtab || HasDwarfSection) {
+ if (ctx.config.debugDwarf || ctx.config.debugSymtab) {
for (ObjFile *file : ctx.objFileInstances) {
for (Symbol *b : file->getSymbols()) {
auto *d = dyn_cast_or_null<Defined>(b);
diff --git a/lld/test/COFF/symtab.test b/lld/test/COFF/symtab.test
index f0a160cec790f..48c749957a422 100644
--- a/lld/test/COFF/symtab.test
+++ b/lld/test/COFF/symtab.test
@@ -8,8 +8,6 @@
# RUN: lld-link /debug /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
# RUN: llvm-readobj --symbols %t.exe | FileCheck -check-prefix=NO %s
-# RUN: lld-link /debug /merge:.blank=.debug_info /out:%t.exe /entry:main %t.obj %p/Inputs/std64.lib
-# RUN: llvm-readobj --symbols %t.exe | FileCheck %s
# CHECK: Symbols [
# CHECK-NEXT: Symbol {
@@ -144,10 +142,6 @@ sections:
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
Alignment: 4
SectionData: 48656C6C6F0048656C6C6F20576F726C6400
- - Name: .blank
- Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_DISCARDABLE, IMAGE_SCN_MEM_READ ]
- Alignment: 1
- SectionData: 0000
symbols:
- Name: "@comp.id"
Value: 10394907
More information about the llvm-commits
mailing list