https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64234
lo1ol <mkh199740 at mail dot ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mkh199740 at mail dot ru --- Comment #6 from lo1ol <mkh199740 at mail dot ru> --- I've the same problem when try to link at runtime shared library compiled with static asan. Here is minimal example: echo ' #include <stdlib.h> #include <stdio.h> void f(){ int* x = new int; printf("kek\n"); }' > lib.cpp echo ' #include <dlfcn.h> #include <stdio.h> int main() { printf("lol\n"); void* handler = dlopen("./libkek.so", RTLD_NOW); if (!handler) return 1; void (* func)() = reinterpret_cast<void(*)()>(dlsym(handler, "_Z1fv")); printf("kek\n"); func(); printf("cheburek\n"); }' > main.cpp g++ -fsanitize=address -static-libasan -static-libstdc++ -static-libgcc -fPIC -shared lib.cpp -o libkek.so g++ -fsanitize=address -static-libasan -static-libstdc++ -static-libgcc -ldl main.cpp LD_DEBUG=libs ./a.out; echo $? Part of the output: ... 347802: initialize program: ./a.out 347802: 347802: 347802: transferring control: ./a.out 347802: lol 347802: ./libkek.so: error: symbol lookup error: undefined symbol: __asan_unregister_globals (fatal) 347802: 347802: calling fini: ./a.out [0] 347802: 347802: 347802: calling fini: /lib/x86_64-linux-gnu/libm.so.6 [0] 347802: With clang everything is ok.... GCC version 12.1 System: Ubuntu 21.10