[PATCH] D77704: [gold] Add support for loading pass plugins

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 17:07:02 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/tools/gold/CMakeLists.txt:1
 set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/gold.exports)
 
----------------
ddcc wrote:
> efriedma wrote:
> > Oh, duh, I just realized the problem with the symbol exports.  The LLVM_EXPORTED_SYMBOL_FILE line suppresses exporting all the symbols pass plugins would normally use.
> > 
> > (And I should have realized export_executable_symbols_for_plugins shouldn't be necessary for a shared library: shared libraries export all symbols by default.)
> Hmm, I tried both with and without `LLVM_EXPORTED_SYMBOL_FILE`, but it didn't seem to make a difference.
> 
> I think the fundamental problem here is that when gold calls `dlopen(LLVMgold.so, RTLD_LAZY)`, it doesn't load provide the `RTLD_GLOBAL` argument, so any symbols in `LLVMgold.so` aren't available to subsequent dynamically-loaded plugins.
Oh, hmm, that makes sense.  That's harder to solve.

We could make LLVMgold.so dlopen() itself, I guess? That seems terribly hacky, though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77704/new/

https://reviews.llvm.org/D77704





More information about the llvm-commits mailing list