diff options
| author | Sam Clegg <sbc@chromium.org> | 2019-06-05 17:39:37 +0000 |
|---|---|---|
| committer | Sam Clegg <sbc@chromium.org> | 2019-06-05 17:39:37 +0000 |
| commit | 579c8df70130c4d41391d62f8f03e2404778945f (patch) | |
| tree | 30a14eea66f3e1df24330c31889c60e2e4b9e4ae /lld/wasm/InputFiles.cpp | |
| parent | b67cb3cda05bb1fa08b4789423983a7ee3f3c5e4 (diff) | |
| download | bcm5719-llvm-579c8df70130c4d41391d62f8f03e2404778945f.tar.gz bcm5719-llvm-579c8df70130c4d41391d62f8f03e2404778945f.zip | |
[lld] Explicitly ignore comdat groups when parsing LTO object(s)
Any symbols defined in the LTO object are by definition the ones we
want in the final output so we skip the comdat group checking in those
cases.
This change makes the ELF code more explicit about this and means
that wasm and ELF do this in the same way.
Differential Revision: https://reviews.llvm.org/D62884
llvm-svn: 362625
Diffstat (limited to 'lld/wasm/InputFiles.cpp')
| -rw-r--r-- | lld/wasm/InputFiles.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp index e1c4fa7b747..23d3900c5ed 100644 --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -306,11 +306,10 @@ void ObjFile::parse(bool IgnoreComdats) { TypeIsUsed.resize(getWasmObj()->types().size(), false); ArrayRef<StringRef> Comdats = WasmObj->linkingData().Comdats; - for (unsigned I = 0; I < Comdats.size(); ++I) - if (IgnoreComdats) - KeptComdats.push_back(true); - else - KeptComdats.push_back(Symtab->addComdat(Comdats[I])); + for (unsigned I = 0; I < Comdats.size(); ++I) { + bool IsNew = IgnoreComdats || Symtab->addComdat(Comdats[I]); + KeptComdats.push_back(IsNew); + } // Populate `Segments`. for (const WasmSegment &S : WasmObj->dataSegments()) @@ -535,10 +534,7 @@ void BitcodeFile::parse(bool IgnoreComdats) { } std::vector<bool> KeptComdats; for (StringRef S : Obj->getComdatTable()) - if (IgnoreComdats) - KeptComdats.push_back(true); - else - KeptComdats.push_back(Symtab->addComdat(S)); + KeptComdats.push_back(Symtab->addComdat(S)); for (const lto::InputFile::Symbol &ObjSym : Obj->symbols()) Symbols.push_back(createBitcodeSymbol(KeptComdats, ObjSym, *this)); |

