Hello, > > I would like to use asan in a freestanding environment. According to link errors, it should be enough to provide functions like: > __ubsan_handle_type_mismatch > __ubsan_handle_out_of_bounds > __ubsan_handle_sub_overflow > __ubsan_handle_add_overflow > > etc. > > Is there such an implementation somewhere? Or is it even possible to configure GCC to build the asan for a generic "elf" target? (just adding --enable-> libsanitizer to configure does "nothing") In the meantime I've implemented dummy handlers: #define DASAN(func) \ extern void func(void *p); \ void func(void *p) \ { \ printf("\n"#func ": %p ptr: %p\n", __builtin_return_address(0)), p); \ /* while(1);*/ \ } DASAN(__ubsan_handle_type_mismatch) DASAN(__ubsan_handle_out_of_bounds) DASAN(__ubsan_handle_sub_overflow) DASAN(__ubsan_handle_add_overflow) DASAN(__ubsan_handle_shift_out_of_bounds) DASAN(__ubsan_handle_divrem_overflow) DASAN(__ubsan_handle_negate_overflow) DASAN(__ubsan_handle_mul_overflow) which does the job "well enough". Note the function prototypes are wrong, they should match https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libsanitizer/ubsan/ubsan_handlers.cc#l74 & friends. Best regards, Zdenek Sojka