GCC fails to build libasan with -mthumb and -fno-omit-frame-pointer
../../../../libsanitizer/sanitizer_common/sanitizer_linux.cc: In function 'sanitizer::uptr sanitizer::internal_clone(int (*)(void*), void*, int, void*, int*, void*, int*)':
../../../../libsanitizer/sanitizer_common/sanitizer_linux.cc:1540:1: error: r7 cannot be used in asm here
}
Regarding to arm ABI, r7 register is using for syscall number, r0 for return value, and r1 - r6 for syscall arguments, by the way r7 for arm with thumb mode is using as frame pointer and it looks like we have a conflict in this case. As far as I understood, GCC has a special check inside IRA
if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, HARD_FRAME_POINTER_REGNUM)), which does not allow to have frame pointer register as clobber register.
There is no issue with clang, but because sanitizer's runtime come from llvm compiler-rt, this fix, ,probably, should be inside llvm compiler-rt.
link to gcc bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86755
Please leave a comment here about why we can't use r7 directly.