1 // Check that cross-DSO diagnostics print the names of both modules
3 // RUN: %clangxx_cfi_diag -g -DSHARED_LIB -fPIC -shared -o %dynamiclib %s %ld_flags_rpath_so
4 // RUN: %clangxx_cfi_diag -g -o %t_exe_suffix %s %ld_flags_rpath_exe
5 // RUN: %t_exe_suffix 2>&1 | FileCheck -DDSONAME=%xdynamiclib_namespec %s
7 // UNSUPPORTED: target={{.*windows-msvc.*}}
21 __attribute__((visibility("default"))) extern "C"
22 void* dso_symbol() { return new S1(); }
28 reinterpret_cast<void*(*)(void)>(dlsym(RTLD_DEFAULT
, "dso_symbol"));
30 perror("failed to resolve dso_symbol");
34 // CHECK: runtime error: control flow integrity check for type 'void *()' failed during indirect function call
35 // CHECK: dso_symbol defined here
36 // CHECK: check failed in {{.*}}_exe_suffix, destination function located in {{.*}}[[DSONAME]]
37 void *S
= fp(); // trigger cfi-icall failure
39 // CHECK: runtime error: control flow integrity check for type 'S1' failed during cast to unrelated type
40 // CHECK: invalid vtable
41 // CHECK: check failed in {{.*}}_exe_suffix, vtable located in {{.*}}[[DSONAME]]
42 S1
*Scast
= reinterpret_cast<S1
*>(S
); // trigger cfi-unrelated-cast failure