[PATCH] D113866: [LLD] [COFF] Omit IMAGE_SYM_CLASS_LABEL symbols from the PE symbol table
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 23 00:39:54 PST 2021
This revision was automatically updated to reflect the committed changes.
mstorsjo marked 2 inline comments as done.
Closed by commit rGd703b922961e: [LLD] [COFF] Omit section symbols and IMAGE_SYM_CLASS_LABEL from the PE symbol… (authored by mstorsjo).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113866/new/
https://reviews.llvm.org/D113866
Files:
lld/COFF/Writer.cpp
lld/test/COFF/strtab-size.s
lld/test/COFF/symtab.test
Index: lld/test/COFF/symtab.test
===================================================================
--- lld/test/COFF/symtab.test
+++ lld/test/COFF/symtab.test
@@ -11,33 +11,6 @@
# CHECK: Symbols [
# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: .text
-# CHECK-NEXT: Value: 0
-# CHECK-NEXT: Section: .text (1)
-# CHECK-NEXT: BaseType: Null (0x0)
-# CHECK-NEXT: ComplexType: Null (0x0)
-# CHECK-NEXT: StorageClass: Static (0x3)
-# CHECK-NEXT: AuxSymbolCount: 0
-# CHECK-NEXT: }
-# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: .text2
-# CHECK-NEXT: Value: 0
-# CHECK-NEXT: Section: .text (1)
-# CHECK-NEXT: BaseType: Null (0x0)
-# CHECK-NEXT: ComplexType: Null (0x0)
-# CHECK-NEXT: StorageClass: Static (0x3)
-# CHECK-NEXT: AuxSymbolCount: 0
-# CHECK-NEXT: }
-# CHECK-NEXT: Symbol {
-# CHECK-NEXT: Name: .data
-# CHECK-NEXT: Value: 0
-# CHECK-NEXT: Section: .data (3)
-# CHECK-NEXT: BaseType: Null (0x0)
-# CHECK-NEXT: ComplexType: Null (0x0)
-# CHECK-NEXT: StorageClass: Static (0x3)
-# CHECK-NEXT: AuxSymbolCount: 0
-# CHECK-NEXT: }
-# CHECK-NEXT: Symbol {
# CHECK-NEXT: Name: MessageBoxA
# CHECK-NEXT: Value: 80
# CHECK-NEXT: Section: .text (1)
@@ -235,4 +208,10 @@
SimpleType: IMAGE_SYM_TYPE_NULL
ComplexType: IMAGE_SYM_DTYPE_NULL
StorageClass: IMAGE_SYM_CLASS_EXTERNAL
+ - Name: .Ltemp_symbol
+ Value: 1
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_LABEL
...
Index: lld/test/COFF/strtab-size.s
===================================================================
--- lld/test/COFF/strtab-size.s
+++ lld/test/COFF/strtab-size.s
@@ -213,4 +213,5 @@
sym192:
sym193:
sym194:
+sym195:
ret
Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/COFF/Writer.cpp
@@ -1211,6 +1211,12 @@
if (!d || d->writtenToSymtab)
continue;
d->writtenToSymtab = true;
+ if (auto *dc = dyn_cast_or_null<DefinedCOFF>(d)) {
+ COFFSymbolRef symRef = dc->getCOFFSymbol();
+ if (symRef.isSectionDefinition() ||
+ symRef.getStorageClass() == COFF::IMAGE_SYM_CLASS_LABEL)
+ continue;
+ }
if (Optional<coff_symbol16> sym = createSymbol(d))
outputSymtab.push_back(*sym);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113866.389109.patch
Type: text/x-patch
Size: 2496 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211123/22ffff54/attachment.bin>
More information about the llvm-commits
mailing list