[lld] r221329 - [PECOFF] Do not skip COMDAT section symbols.
Rui Ueyama
ruiu at google.com
Tue Nov 4 18:21:39 PST 2014
Author: ruiu
Date: Tue Nov 4 20:21:39 2014
New Revision: 221329
URL: http://llvm.org/viewvc/llvm-project?rev=221329&view=rev
Log:
[PECOFF] Do not skip COMDAT section symbols.
LLD skipped COMDAT section symbols when reading them because
I thought we don't want to have symbols with the same name.
But they are actually needed because relocations may refer to
the section symbols. So we shoulnd't skip them.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
lld/trunk/test/pecoff/merge-largest.test
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=221329&r1=221328&r2=221329&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Tue Nov 4 20:21:39 2014
@@ -517,17 +517,6 @@ FileCOFF::createDefinedSymbols(const Sym
return ec;
assert(sec && "SectionIndex > 0, Sec must be non-null!");
- // Skip if it's a section symbol for a COMDAT section. A section symbol
- // has the name of the section and value 0. A translation unit may contain
- // multiple COMDAT sections whose section name are the same. We don't want
- // to make atoms for them as they would become duplicate symbols.
- StringRef sectionName;
- if (std::error_code ec = _obj->getSectionName(sec, sectionName))
- return ec;
- if (_symbolName[sym] == sectionName && sym.getValue() == 0 &&
- _merge[sec] != DefinedAtom::mergeNo)
- continue;
-
uint8_t sc = sym.getStorageClass();
if (sc != llvm::COFF::IMAGE_SYM_CLASS_EXTERNAL &&
sc != llvm::COFF::IMAGE_SYM_CLASS_STATIC &&
Modified: lld/trunk/test/pecoff/merge-largest.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/merge-largest.test?rev=221329&r1=221328&r2=221329&view=diff
==============================================================================
--- lld/trunk/test/pecoff/merge-largest.test (original)
+++ lld/trunk/test/pecoff/merge-largest.test Tue Nov 4 20:21:39 2014
@@ -19,6 +19,6 @@ READOBJ-NEXT: Sections [
READOBJ-NEXT: Section {
READOBJ-NEXT: Number: 1
READOBJ-NEXT: Name: .text (2E 74 65 78 74 00 00 00)
-READOBJ-NEXT: VirtualSize: 0x8
+READOBJ-NEXT: VirtualSize: 0x12
READOBJ-NEXT: VirtualAddress: 0x1000
READOBJ-NEXT: RawDataSize: 512
More information about the llvm-commits
mailing list