1 // Test indirect call wrapping in MemorySanitizer. 2 3 // RUN: %clangxx_msan -O0 %p/wrap_indirect_calls/two.cc -fPIC -shared -o %t-two-so.so 4 // RUN: %clangxx_msan -O0 %p/wrap_indirect_calls/wrapper.cc -fPIC -shared -o %t-wrapper-so.so 5 6 // Disable fast path. 7 8 // RUN: %clangxx_msan -O0 %p/wrap_indirect_calls/caller.cc %p/wrap_indirect_calls/one.cc %s \ 9 // RUN: %t-two-so.so %t-wrapper-so.so \ 10 // RUN: -mllvm -msan-wrap-indirect-calls=wrapper \ 11 // RUN: -mllvm -msan-wrap-indirect-calls-fast=0 \ 12 // RUN: -DSLOW=1 \ 13 // RUN: -Wl,--defsym=__executable_start=0 -o %t 14 // RUN: %run %t 15 16 // Enable fast path, call from executable, -O0. 17 18 // RUN: %clangxx_msan -O0 %p/wrap_indirect_calls/caller.cc %p/wrap_indirect_calls/one.cc %s \ 19 // RUN: %t-two-so.so %t-wrapper-so.so \ 20 // RUN: -mllvm -msan-wrap-indirect-calls=wrapper \ 21 // RUN: -mllvm -msan-wrap-indirect-calls-fast=1 \ 22 // RUN: -DSLOW=0 \ 23 // RUN: -Wl,--defsym=__executable_start=0 -o %t 24 // RUN: %run %t 25 26 // Enable fast path, call from executable, -O3. 27 28 // RUN: %clangxx_msan -O3 %p/wrap_indirect_calls/caller.cc %p/wrap_indirect_calls/one.cc %s \ 29 // RUN: %t-two-so.so %t-wrapper-so.so \ 30 // RUN: -mllvm -msan-wrap-indirect-calls=wrapper \ 31 // RUN: -mllvm -msan-wrap-indirect-calls-fast=1 \ 32 // RUN: -DSLOW=0 \ 33 // RUN: -Wl,--defsym=__executable_start=0 -o %t 34 // RUN: %run %t 35 36 // Enable fast path, call from DSO, -O0. 37 38 // RUN: %clangxx_msan -O0 %p/wrap_indirect_calls/caller.cc %p/wrap_indirect_calls/one.cc -shared \ 39 // RUN: %t-two-so.so %t-wrapper-so.so \ 40 // RUN: -mllvm -msan-wrap-indirect-calls=wrapper \ 41 // RUN: -mllvm -msan-wrap-indirect-calls-fast=1 \ 42 // RUN: -DSLOW=0 \ 43 // RUN: -Wl,--defsym=__executable_start=0 -o %t-caller-so.so 44 // RUN: %clangxx_msan -O0 %s %t-caller-so.so %t-two-so.so %t-wrapper-so.so -o %t 45 // RUN: %run %t 46 47 // Enable fast path, call from DSO, -O3. 48 49 // RUN: %clangxx_msan -O3 %p/wrap_indirect_calls/caller.cc %p/wrap_indirect_calls/one.cc -shared \ 50 // RUN: %t-two-so.so %t-wrapper-so.so \ 51 // RUN: -mllvm -msan-wrap-indirect-calls=wrapper \ 52 // RUN: -mllvm -msan-wrap-indirect-calls-fast=1 \ 53 // RUN: -DSLOW=0 \ 54 // RUN: -Wl,--defsym=__executable_start=0 -o %t-caller-so.so 55 // RUN: %clangxx_msan -O3 %s %t-caller-so.so %t-two-so.so %t-wrapper-so.so -o %t 56 // RUN: %run %t 57 58 // The actual test is in multiple files in wrap_indirect_calls/ directory. 59 void run_test(); 60 61 int main() { 62 run_test(); 63 return 0; 64 } 65