Christophe Lyon via llvm-dev
2019-Apr-29 09:30 UTC
[llvm-dev] UBSAN on bare-metal (newlib on ARM)
Hi, We found it would user-friendly on bare-metal system where semihosting allows printing messages if UBSAN could use this instead of supporting -fsanitize-undefined-trap-on-error only, where the user has to user a debugger to catch the traps. I wrote a prototype in GCC (being a GCC developer) for arm-eabi using newlib, where I basically created new runtime "bare-metal" support similar to sanitizer_linux.cc but with obviously much less support. It passes most of the GCC UBSAN tests, so I thought it would be interesting to try to upstream it. However, I don't know how to cross-build compiler-rt libraries for bare-metal ARM, and more generally I'm not sure how I should update LLVM/compiler-rt 's build system for such a case. I've noticed that there is support for ARM-RTEMS, so maybe I could use the relevant patches as a model? Are there any instructions on how to build an LLVM toolchain for ARM-RTEMS? Or some information on how to add support for a new OS in compiler-rt/sanitizers? The scope is restricted to UBSAN, and does not include ASAN, MSAN, TSAN, ... Thanks in advance, Christophe