1 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO1 -fPIC -shared %s -o %dynamiclib1
2 // RUN: %clangxx_asan -fno-rtti -DBUILD_SO2 -fPIC -shared %s -o %dynamiclib2
3 // RUN: %clangxx_asan -fno-rtti %s %ld_flags_rpath_exe1 %ld_flags_rpath_exe2 -o %t
4 // RUN: %env_asan_opts=fast_unwind_on_malloc=0:detect_odr_violation=2 not %run %t 2>&1 | FileCheck %s
5 
6 struct XYZ {
7   virtual void foo();
8 };
9 
10 #if defined(BUILD_SO1)
11 
12 void XYZ::foo() {}
13 
14 #elif defined(BUILD_SO2)
15 
16 void XYZ::foo() {}
17 
18 #else
19 
20 int main() {}
21 
22 #endif
23 
24 // CHECK: AddressSanitizer: odr-violation
25 // CHECK-NEXT: 'vtable for XYZ'
26 // CHECK-NEXT: 'vtable for XYZ'
27