[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.

llvm-svn: 221329
This commit is contained in:
Rui Ueyama 2014-11-05 02:21:39 +00:00
parent b28deb1967
commit cace52091b
2 changed files with 1 additions and 12 deletions

View File

@ -517,17 +517,6 @@ FileCOFF::createDefinedSymbols(const SymbolVectorT &symbols,
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 &&

View File

@ -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