edA-qa mort-ora-y via llvm-dev
2018-Feb-25 08:41 UTC
[llvm-dev] segfault calling SDL_Init with FFI/ MCJIT
I'm getting a segfault when I call `SDL_Init( SDL_INIT_VIDEO )` within the MCJIT. If I compile the same program to an EXE I don't have a problem. Are there any general restrictions, or known issues, with loading a library like SDL2 via the MCJIT? (LLVM-3.8 still) The stack trace, from GDB, is below. I noticed the error actually happens deep inside a transitively loaded GL drive module, but still within the LLVM code. Does LLVM have hooks for when libraries are loaded? #0 __strcmp_ssse3 () at ../sysdeps/x86_64/multiarch/../strcmp.S:173 #1 0x00007fffeff1a667 in llvm::cl::generic_parser_base::findOption(char const*) () from /home/src/leaf/sdl/dist/libLLVM-3.8.so #2 0x00007ffff02f291f in llvm::RegisterPassParser<llvm::MachineSchedRegistry>::NotifyAdd(char const*, void* (*)(), char const*) () from /home/src/leaf/sdl/dist/libLLVM-3.8.so #3 0x00007fffe3ab4754 in llvm::MachinePassRegistry::Add(llvm::MachinePassRegistryNode*) () from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1 #4 0x00007fffe36fe616 in ?? () from /usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1 #5 0x00007ffff7de76ba in call_init (l=<optimised out>, argc=argc at entry=4, argv=argv at entry=0x7fffffffdae8, env=env at entry=0x7fffffffdb10) at dl-init.c:72 #6 0x00007ffff7de77cb in call_init (env=0x7fffffffdb10, argv=0x7fffffffdae8, argc=4, l=<optimised out>) at dl-init.c:30 #7 _dl_init (main_map=main_map at entry=0x775af0, argc=4, argv=0x7fffffffdae8, env=0x7fffffffdb10) at dl-init.c:120 #8 0x00007ffff7dec8e2 in dl_open_worker (a=a at entry=0x7fffffffc520) at dl-open.c:575 #9 0x00007ffff7de7564 in _dl_catch_error (objname=objname at entry=0x7fffffffc510, errstring=errstring at entry=0x7fffffffc518, mallocedp=mallocedp at entry=0x7fffffffc50f, operate=operate at entry=0x7ffff7dec4d0 <dl_open_worker>, args=args at entry=0x7fffffffc520) at dl-error.c:187 #10 0x00007ffff7debda9 in _dl_open (file=0x7fffffffc7a0 "/usr/lib/x86_64-linux-gnu/dri/r600_dri.so", mode=-2147483390, caller_dlopen=0x7fffe9580a39, nsid=-2, argc=<optimised out>, argv=<optimised out>, env=0x7fffffffdb10) at dl-open.c:660 #11 0x00007ffff53c4f09 in dlopen_doit (a=a at entry=0x7fffffffc750) at dlopen.c:66 #12 0x00007ffff7de7564 in _dl_catch_error (objname=0x69e560, errstring=0x69e568, mallocedp=0x69e558, operate=0x7ffff53c4eb0 <dlopen_doit>, args=0x7fffffffc750) at dl-error.c:187 #13 0x00007ffff53c5571 in _dlerror_run (operate=operate at entry=0x7ffff53c4eb0 <dlopen_doit>, args=args at entry=0x7fffffffc750) at dlerror.c:163 #14 0x00007ffff53c4fa1 in __dlopen (file=<optimised out>, mode=<optimised out>) at dlopen.c:87 #15 0x00007fffe9580a39 in ?? () from /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 #16 0x00007fffe95838f3 in ?? () from /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 #17 0x00007fffe955ba54 in ?? () from /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 #18 0x00007fffe9557c2b in ?? () from /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 #19 0x00007fffe9558062 in glXQueryExtensionsString () from /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 #20 0x00007fffef080caf in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2.so #21 0x00007fffef07337f in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2.so #22 0x00007fffef07528c in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2.so #23 0x00007fffef074f35 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2.so #24 0x00007fffeefdc397 in ?? () from /usr/lib/x86_64-linux-gnu/libSDL2.so #25 0x00007ffff7ff654c in _init_module_main_5 () #26 0x00007ffff7ff610f in _entry () #27 0x00007ffff7ff69ec in main () #28 0x00007ffff0d7f9bd in llvm::MCJIT::runFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>) () from /home/src/leaf/sdl/dist/libLLVM-3.8.so #29 0x00007ffff4c843d9 in ir_llvm::gen::execute (this=this at entry=0x7fffffffcdb0, m=..., sc="") at src/ir/llvm/gen.cpp:249 #30 0x00007ffff6bd9e90 in runner::execute (this=0x7fffffffd8d0, m=std::shared_ptr (count 3, weak 0) 0x6dc3b0, args=std::vector of length 0, capacity 0) at src/runner/runner.cpp:339 #31 0x00007ffff6bda264 in runner::execute (this=this at entry=0x7fffffffd8d0, m=std::shared_ptr (count 3, weak 0) 0x6dc3b0) at src/runner/runner.cpp:264 #32 0x0000000000413687 in main (argc=4, argv=0x7fffffffdae8) at src/bin/leaf.cpp:256 -- edA-qa mort-ora-y http://mortoray.com/ Creator of the Leaf language http://leaflang.org/ Streaming algorithms, AI, and design on Twitch https://www.twitch.tv/mortoray Twitter edaqa
Reasonably Related Threads
- [LLVMdev] Segfault when using llvm-3.6 and OpenGL at the same time on Linux (with mesa, which uses llvm-3.4)
- OpenJDK8 failed to work after compiled by LLVM 8 for X86
- OpenJDK8 failed to work after compiled by LLVM 8 for X86
- OpenJDK8 failed to work after compiled by LLVM 8 for X86
- qemu -display sdl,gl=on also eats CPU