1 // Test __msan_set_indirect_call_wrapper.
3 // RUN: %clangxx_msan -mllvm -msan-wrap-indirect-calls=__msan_wrap_indirect_call \
4 // RUN: -mllvm -msan-wrap-indirect-calls-fast=0 \
5 // RUN: -O0 -g -rdynamic -Wl,--defsym=__executable_start=0 %s -o %t && %run %t
7 // This test disables -msan-wrap-indirect-calls-fast, otherwise indirect calls
8 // inside the same module are short-circuited and are never seen by the wrapper.
15 extern "C" void __msan_set_indirect_call_wrapper(uintptr_t);
29 typedef void (*Fn
)(void);
30 extern "C" Fn
my_wrapper(Fn target
) {
31 if (target
== f
) return g
;
39 __msan_set_indirect_call_wrapper((uintptr_t)my_wrapper
);
41 return !(done_f
&& done_g
);