LLVM not properly shutdown in `si_pipe.c`?
Submitted by Hal Gentz
Assigned to Default DRI bug account
tl;dr; Shouldn't we be calling
I had a program which was calling:
eglInitialize(disp, &majoir, &minor); eglTerminate(disp); eglInitialize(disp, &majoir, &minor);
Which lead to mesa outputting the following before continuing on normally during the second call to
mesa: for the -simplifycfg-sink-common option: may only occur zero or one times! mesa: for the -global-isel-abort option: may only occur zero or one times!
This prompted an investigation me to investigate, and with the aid of @imirkin, I think I got the cause.
You see, in an
radeonsi_dri.so gets loaded, which also loads in
libLLVM-9svn.so, and eventually
ac_init_llvm_once() gets called more than once.
That's OK, for as the name implies, it only happens once.
Issue is, when
eglTerminate is called,
radeonsi_dri.so gets unloaded, but not
libLLVM-9svn.so. This means that the next time we all
ManagedStatics will be preserved, but not our static var
We can fix this by calling
LLVMShutdown before unloading
radeonsi_dri.so, that way LLVM's
ManagedStatics are also reset.
Alas, I'm not familiar enough with the mesa codebase, so I got no clue where the appropriate place to plop this function is. Any aid would be well appreciated.