GCC11.3.0
Unloading a DSO that registers destructors/functions to be run on exit, will always crash when the main program exits
static dtors are not run on DSO unload, but at program exit. Since the SO is already unloaded, this causes a crash.
A simplified version of the repro code is at
https://github.com/PushmePullyu/sotest/tree/repro-dlclose-dtors
which removes the SDL dependency
See here for the full discussion:
https://bugs.scummvm.org/ticket/15015