1 // RUN: %clangxx -DFUNC=zzzz %s -shared -o %dynamiclib -fPIC
2 // RUN: %clangxx_asan -DFUNC=main %s -o %t %ld_flags_rpath_exe
5 // GNU driver doesn't handle .so files properly.
8 // This test ensures that we call __asan_init early enough.
9 // We build a shared library w/o asan instrumentation
10 // and the binary with asan instrumentation.
11 // Both files include the same header (emulated by -DFUNC here)
12 // with C++ template magic which runs global initializer at library load time.
13 // The function get() is instrumented with asan, but called
14 // before the usual constructors are run.
15 // So, we must make sure that __asan_init is executed even earlier.
17 // See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56393
20 int foo() const { return 0; }
22 A
get () { return A(); }
23 template <class> struct O
{
26 template <class T
> A
const O
<T
>::e
= get();
28 return O
<int>::e
.foo();