Index: compiler-rt/test/asan/TestCases/Linux/dlopen-mixed-c-cxx.c =================================================================== --- compiler-rt/test/asan/TestCases/Linux/dlopen-mixed-c-cxx.c +++ compiler-rt/test/asan/TestCases/Linux/dlopen-mixed-c-cxx.c @@ -28,9 +28,18 @@ #else +#define _GNU_SOURCE #include #include +// Wrap __cxa_throw to make sure it's defined in the main executable. +typedef void (*cxa_throw_t)(void *, void *, void (*)(void *)); +void __cxa_throw(void *thrown_exception, void *tinfo, + void (*dest)(void *)) { + cxa_throw_t real = dlsym(RTLD_NEXT, "__cxa_throw"); + real(thrown_exception, tinfo, dest); +} + int main(int argc, char **argv) { int (*bar)(void); void *handle = dlopen(argv[1], RTLD_LAZY);