1 // Check that --gc-sections does not throw away (or localize) parts of sanitizer
3 // RUN: %clang_asan -m64 %s -Wl,--gc-sections -o %t
4 // RUN: %clang_asan -m64 %s -DBUILD_SO -fPIC -o %t-so.so -shared
13 int main(int argc
, char *argv
[]) {
15 snprintf(path
, sizeof(path
), "%s-so.so", argv
[0]);
17 void *handle
= dlopen(path
, RTLD_LAZY
);
18 if (!handle
) fprintf(stderr
, "%s\n", dlerror());
22 F f
= (F
)dlsym(handle
, "call_rtl_from_dso");
23 printf("%s\n", dlerror());
24 assert(dlerror() == 0);
33 #include <sanitizer/msan_interface.h>
34 extern "C" void call_rtl_from_dso() {
36 volatile int32_t y
= __sanitizer_unaligned_load32((void *)&x
);