[ubsan] Add UBSAN implementation
Add an UBSAN implementation and a new UBSAN switch to the make build. The implementation is taken from Onyx and handles most of the cases that should be needed for a kernel build. Floating point and fancy C++ CFI features are not supported yet. To build with UBSAN, pass UBSAN=1 to make such as: PROJECT=pc-x86-64-test make -jN UBSAN=1
This commit is contained in:
committed by
Travis Geiselbrecht
parent
bf2e94c2f8
commit
8ebbcea5ed
@@ -71,6 +71,12 @@ GLOBAL_CPPFLAGS := --std=c++14 -fno-exceptions -fno-rtti -fno-threadsafe-statics
|
||||
GLOBAL_ASMFLAGS := -DASSEMBLY
|
||||
GLOBAL_LDFLAGS :=
|
||||
|
||||
ifeq ($(UBSAN), 1)
|
||||
# Inject lib/ubsan directly into MODULE_DEPS
|
||||
# lib/ubsan will itself add the needed CFLAGS
|
||||
MODULE_DEPS += lib/ubsan
|
||||
endif
|
||||
|
||||
# flags that are sometimes nice to enable to catch problems but too strict to have on all the time.
|
||||
# add to global flags from time to time to find things, otherwise only available with a module
|
||||
# option (see make/module.mk re: MODULE_OPTIONS).
|
||||
|
||||
Reference in New Issue
Block a user