[PATCH] D43011: [ELF] Create and export symbols provided by a linker script if they referenced by DSOs.

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 20:08:32 PST 2018


ikudrin added inline comments.


================
Comment at: ELF/InputFiles.h:344
 extern std::vector<InputFile *> SharedFiles;
+extern llvm::DenseSet<StringRef> UndefsInShlibs;
 
----------------
grimar wrote:
> It seems like instead of adding global variable you can make helper that
> would scan over `SharedFiles` and invoke `SharedFile::getUndefinedSymbols`
> to build the same set and then pass it to `shouldDefineSym` ?
We call `shouldDefineSym` not only in `declareSymbols` but also in `addSymbol`, which might be called several times. As a result, the set itself would be created several times.

Moreover, `SharedFiles` requires a template argument, so all involved methods would become templates too.

I thought about keeping PROVIDE symbols which are not created during `declareSymbols` call. `SymbolTable::scanShlibUndefined` would then ask `LinkerScript` to create referenced symbols. However, it looks like blurring of responsibility to me.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43011





More information about the llvm-commits mailing list