[PATCH] D41269: [COFF] Warn for locally imported symbols

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 19:51:47 PST 2017


ruiu added inline comments.


================
Comment at: COFF/SymbolTable.cpp:66
   SmallPtrSet<Symbol *, 8> Undefs;
+  DenseMap<Symbol *, Symbol *> UndefsToLocalImports;
 
----------------
I'd name this LocalImports.


================
Comment at: COFF/SymbolTable.cpp:102
         LocalImportChunks.push_back(cast<DefinedLocalImport>(Sym)->getChunk());
+        UndefsToLocalImports.try_emplace(Sym, D);
         continue;
----------------
smeenai wrote:
> ruiu wrote:
> > Can you just call warn() here?
> I definitely want to report the object file which is importing the symbol (link.exe does even better and reports the function that's doing the import, but I believe reporting the object file is the best we can do). As far as I can tell, the only way to figure out the object file(s) that are doing the import is to loop through the symbols in `Config->GCRoot` and every object file, as is done below (in the loops I've modified). I could duplicate those loops here to inline the warning, but it seemed better to avoid the duplication and reuse the existing loops.
I see. But the way you are using the map is not correct. Sym and D are always the same pointer value. You can use a set instead of map.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41269





More information about the llvm-commits mailing list