1 // This is a hack to access CFI interface that Android has in libdl.so on
2 // device, but not in the NDK.
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");
16 (cfi_slowpath_diag_ty
)dlsym(RTLD_NEXT
, "__cfi_slowpath_diag");
17 if (!cfi_slowpath
|| !cfi_slowpath_diag
) abort();
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
);