mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-06 22:01:29 +00:00
[Makefile] add option to enable gcc sanitizer for UB and asan
Add option to enable gcc sanitizer option for undefined behavior. The following changesets will make ubsan work. Signed-off-by: Isaku Yamahata <isaku.yamahata@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@ CFLAGS = -Wall -fPIC -std=c11 -Winline -Wwrite-strings \
|
||||
-fmerge-all-constants -Wstrict-prototypes \
|
||||
-Werror=implicit-function-declaration \
|
||||
$(cc-option, -Wnull-dereference) \
|
||||
$(CFLAGS_SANITIZE) \
|
||||
-fno-stack-protector -fno-builtin -Wno-inline \
|
||||
-I../include -I../../../Pal/lib -I../../../Pal/include/pal
|
||||
|
||||
|
||||
@@ -11,3 +11,13 @@ ifeq ($(origin LD),default)
|
||||
LD = ld
|
||||
endif
|
||||
OBJCOPY ?= objcopy
|
||||
|
||||
# CONFIG_ENABLE_UBSAN=y
|
||||
CONFIG_ENABLE_UBSAN=n
|
||||
|
||||
#
|
||||
# variables depend on configrations
|
||||
#
|
||||
ifeq ($(CONFIG_ENABLE_UBSAN),y)
|
||||
CFLAGS_SANITIZE += $(call cc-option,-fsanitize=undefined)
|
||||
endif
|
||||
|
||||
+2
-1
@@ -5,7 +5,8 @@ include ../src/Makefile.Host
|
||||
CFLAGS = -Wall -fPIC -O2 -std=gnu99 -fgnu89-inline -U_FORTIFY_SOURCE \
|
||||
$(call cc-option,-Wnull-dereference) \
|
||||
-fno-omit-frame-pointer \
|
||||
-fno-stack-protector -fno-builtin
|
||||
-fno-stack-protector -fno-builtin \
|
||||
$(CFLAGS_SANITIZE)
|
||||
ARFLAGS =
|
||||
|
||||
include ../src/host/$(PAL_HOST)/Makefile.am
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
HOST_DIR = host/$(PAL_HOST)
|
||||
|
||||
CFLAGS = -Wall -fPIC -O2 -maes -std=c11 -U_FORTIFY_SOURCE \
|
||||
$(CFLAGS_SANITIZE) \
|
||||
-fno-omit-frame-pointer \
|
||||
-fno-stack-protector -fno-builtin
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ HOST_DIR = host/$(PAL_HOST)
|
||||
SEC_DIR = security/$(PAL_HOST)
|
||||
|
||||
CFLAGS = -Wall -fPIC -O2 -std=c11 -U_FORTIFY_SOURCE \
|
||||
-fno-stack-protector -fno-builtin
|
||||
-fno-stack-protector -fno-builtin \
|
||||
$(CFLAGS_SANITIZE)
|
||||
|
||||
EXTRAFLAGS = -Wextra $(call cc-option,-Wnull-dereference)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user