[cfe-dev] Running opt passes via Clang on OSX dlclose segfault issue
Andrzej Warzynski via cfe-dev
cfe-dev at lists.llvm.org
Wed Oct 2 05:17:19 PDT 2019
I think that similar issue is being discussed here:
https://github.com/sampsyo/llvm-pass-skeleton/issues/7
I've experienced similar problem when trying to register a pass using
this extension point:
llvm::PassManagerBuilder::EP_EarlyAsPossible
I've only tested with 'opt' and noticed that it only seg-faults when
using pre-build packages (checked with LLVM 8), but is fine when
building LLVM from sources.
I haven't had the time to dive deeper.
-Andrzej
On 01/10/2019 15:56, Lewis, Cannada via cfe-dev wrote:
> Hello,
>
> I would like to be able to run the LLVMHello pass (modified to be registered as a standard pass) via clang on OSX, but I am not able to do so because during llvm_shutdown there is a segfault.
>
> I have traced the issue to the fact that in the StaticList (ManagedStatic.cpp) cleanup dlclose gets called on the library followed by the destructor for the std::function stored in the GlobalExtensions (PassManagerBuilder.h) vector, leading to a bad access since the library has been unloaded. On Linux this can be worked around by linking with -znodelete, but on OSX, as far as I can tell, there is not an equivalent linker flag.
>
> The easiest solution I was able to come up with, but that likely isn’t acceptable, is to just pass RTLD_NODELETE to the dlopen arguments in DynamicLibrary.inc.
>
> I am willing to fix this and submit a patch if the work required is not too large, but first I want to see what the general opinion on this issue is and get some guidance on what an acceptable fix would be.
>
> -Cannada Lewis
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
More information about the cfe-dev
mailing list