[PATCH] D56015: Allow new comdat symbols to be added as a result of LTO.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 21 11:08:29 PST 2018


ruiu created this revision.
ruiu added reviewers: tejohnson, pcc.
Herald added subscribers: dexonsmith, arichardson, inglorion, mehdi_amini, emaste.
Herald added a reviewer: espindola.

Previously, if you add two comdat symbols as a result of LTO,
they are reported as duplicate symbols because comdat symbols
are not uniquified after LTO.

This patch allows LTO to add comdat symbols. The DenseSet contains
comdat symbols we've seen so far. Instead of discarding the DenseSet
for each file reading, we use the same set to read all compiled
native object files.

I have a few questions about this patch though:

- Is it assumed for LTO to add new comdat symbols as a result of LTO?
- How can I test this patch?


https://reviews.llvm.org/D56015

Files:
  lld/ELF/SymbolTable.cpp


Index: lld/ELF/SymbolTable.cpp
===================================================================
--- lld/ELF/SymbolTable.cpp
+++ lld/ELF/SymbolTable.cpp
@@ -129,10 +129,10 @@
   for (BitcodeFile *F : BitcodeFiles)
     LTO->add(*F);
 
+  DenseSet<CachedHashStringRef> Groups;
   for (InputFile *File : LTO->compile()) {
-    DenseSet<CachedHashStringRef> DummyGroups;
     auto *Obj = cast<ObjFile<ELFT>>(File);
-    Obj->parse(DummyGroups);
+    Obj->parse(Groups);
     for (Symbol *Sym : Obj->getGlobalSymbols())
       Sym->parseSymbolVersion();
     ObjectFiles.push_back(File);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56015.179317.patch
Type: text/x-patch
Size: 586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181221/ed708c95/attachment.bin>


More information about the llvm-commits mailing list