diff options
author | Rui Ueyama <ruiu@google.com> | 2014-11-05 02:21:39 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2014-11-05 02:21:39 +0000 |
commit | cace52091b3e52eebcebe602755e417cad00b8b3 (patch) | |
tree | e9ff98c9dc4d1427d4e1f9ee7077b4ec84425db7 | |
parent | b28deb19673f469703997c66655bcde5d2326b8d (diff) | |
download | bcm5719-llvm-cace52091b3e52eebcebe602755e417cad00b8b3.tar.gz bcm5719-llvm-cace52091b3e52eebcebe602755e417cad00b8b3.zip |
[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
-rw-r--r-- | lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp | 11 | ||||
-rw-r--r-- | lld/test/pecoff/merge-largest.test | 2 |
2 files changed, 1 insertions, 12 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index e14db7249c3..889cbbe6906 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -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 && diff --git a/lld/test/pecoff/merge-largest.test b/lld/test/pecoff/merge-largest.test index c3ee96ca9c5..9273cf0da4f 100644 --- a/lld/test/pecoff/merge-largest.test +++ b/lld/test/pecoff/merge-largest.test @@ -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 |