1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/makefiles/ubsan.inc.mk
Frederik Haxel 0c2cfe99e6 native64: Add Linux/x86_64 board
Adds a separate board for native64 instead of the `NATIVE_64BIT` workaround.
The files in `boards/native64` are more or less dummy files and just include
the `boards/native` logic (similar to `openlabs-kw41z-mini-256kib`).
The main logic for native is in `makefiles/arch/native.inc.mk`, `cpu/native`
and `boards/native`.

The remaining changes concern the build system, and change native board checks
to native CPU checks to cover both boards.
2024-02-05 22:01:40 +01:00

37 lines
1.1 KiB
Makefile

# Copyright (C) 2019 Kaspar Schleiser <kaspar@schleiser.de>
#
# This file contains support for UBSan, the undefined behaviour sanitizer
# provided by gcc and clang.
#
# Please see doc/doxygen/src/debugging-aids.md for more info.
# trap, msg_exit, msg_recover
UBSAN_MODE ?= msg_exit
CFLAGS_UBSAN = -fsanitize=undefined
ifeq (gnu,$(TOOLCHAIN))
ifeq (native,$(CPU))
ifneq (,$(filter msg_%,$(UBSAN_MODE)))
LINKFLAGS_UBSAN += -lubsan
ifneq (msg_recover,$(UBSAN_MODE))
CFLAGS_UBSAN += -fno-sanitize-recover=undefined
endif
else
CFLAGS_UBSAN += -fsanitize-undefined-trap-on-error
endif
else
# on real hardware, there's currently no runtime support.
# so just crash when undefined behaviour is triggered.
CFLAGS_UBSAN += -fsanitize-undefined-trap-on-error
endif
else
# libubsan doesn't link properly when using clang.
# thus when using llvm as toolchain, always generate traps.
CFLAGS_UBSAN += -fsanitize-trap=undefined
endif
all-ubsan: CFLAGS += $(CFLAGS_UBSAN)
all-ubsan: LINKFLAGS += $(LINKFLAGS_UBSAN)
all-ubsan: all