Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / cfi / cross-dso / util / cfi_stubs.h
blobb742074f037e1bdb8eb6c2e8483adb00343c3776
1 // This is a hack to access CFI interface that Android has in libdl.so on
2 // device, but not in the NDK.
3 #include <dlfcn.h>
4 #include <stdint.h>
5 #include <stdlib.h>
7 typedef void (*cfi_slowpath_ty)(uint64_t, void *);
8 typedef void (*cfi_slowpath_diag_ty)(uint64_t, void *, void *);
10 static cfi_slowpath_ty cfi_slowpath;
11 static cfi_slowpath_diag_ty cfi_slowpath_diag;
13 __attribute__((constructor(0), no_sanitize("cfi"))) static void init() {
14 cfi_slowpath = (cfi_slowpath_ty)dlsym(RTLD_NEXT, "__cfi_slowpath");
15 cfi_slowpath_diag =
16 (cfi_slowpath_diag_ty)dlsym(RTLD_NEXT, "__cfi_slowpath_diag");
17 if (!cfi_slowpath || !cfi_slowpath_diag) abort();
20 extern "C" {
21 __attribute__((visibility("hidden"), no_sanitize("cfi"))) void __cfi_slowpath(
22 uint64_t Type, void *Addr) {
23 cfi_slowpath(Type, Addr);
26 __attribute__((visibility("hidden"), no_sanitize("cfi"))) void
27 __cfi_slowpath_diag(uint64_t Type, void *Addr, void *Diag) {
28 cfi_slowpath_diag(Type, Addr, Diag);