[PATCH] D72327: Fix compiler extension builds

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 12:44:51 PST 2020


serge-sans-paille updated this revision to Diff 237161.
serge-sans-paille added a comment.
Herald added subscribers: hiraditya, mehdi_amini.

- Fix OSX build.

The problem was deeper than expected and arise when the pass extension mechanism is used from plugin *and* static library, e.g. when Polly is linked in and a plugin is loaded.

In that case, the pass extension registry may be initialized before the first shared library is opened, and thus upon llvm_shutdown, the library ar dlclosed *before* the pass extension registered is deleted. At that moment the callback registered in the pass extension registry points to a function from the dlclosed library, and bad thing happens (namely the std::function destructor segfaults).

The patch consists in forcing the init order through a call to a function that triggers the construction of the managedstatic holding thedlopened library handles.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72327

Files:
  llvm/cmake/modules/AddLLVM.cmake
  llvm/examples/Bye/CMakeLists.txt
  llvm/include/llvm/Support/DynamicLibrary.h
  llvm/lib/Support/DynamicLibrary.cpp
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/test/Feature/load_extension.ll
  llvm/test/lit.cfg.py
  polly/lib/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72327.237161.patch
Type: text/x-patch
Size: 8040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200109/f6873ba7/attachment.bin>


More information about the llvm-commits mailing list