mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-04-28 11:43:56 +00:00
Makefile: add gcc flags to prevent some optimization
Add the below flags, they are needed in -O2: -fno-delete-null-pointer-checks: * tells the compiler NOT to assume that null pointer deference does not exist. * Without this flag, below case cannot be detected: a pointer might point to nullsometime during run-time and if there is no validation for that pointer, it will cause the program to crash. Since we don’t receive an error message saying that a pointer is pointing to null, we will have a hard time trying to find the problem. -fwrapv: * tells the compiler that signed overflow always wraps. * Without this flag, x + 10 > x will always be true for signed x. With the flag, x + 10 > x is not always be true, as the overflow is defined for x, and it could wrap. Tracked-On: #4194 Signed-off-by: Conghui Chen <conghui.chen@intel.com> Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
This commit is contained in:
parent
c2c05a29da
commit
557e7f19f7
@ -19,6 +19,7 @@ CFLAGS += -Wall -ffunction-sections
|
||||
CFLAGS += -Werror
|
||||
CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
|
||||
CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
|
||||
CFLAGS += -fno-delete-null-pointer-checks -fwrapv
|
||||
CFLAGS += -fpie
|
||||
CFLAGS += -Wno-stringop-truncation -Wno-address-of-packed-member
|
||||
|
||||
|
@ -11,6 +11,7 @@ MANAGER_CFLAGS += -Wall -ffunction-sections
|
||||
MANAGER_CFLAGS += -Werror
|
||||
MANAGER_CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
|
||||
MANAGER_CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
|
||||
MANAGER_CFLAGS += -fno-delete-null-pointer-checks -fwrapv
|
||||
MANAGER_CFLAGS += -fpie -fpic
|
||||
#FIXME: remove me. work-around for system() calls, which will be removed
|
||||
MANAGER_CFLAGS += -Wno-format-truncation -Wno-unused-result
|
||||
|
@ -74,6 +74,7 @@ CFLAGS=-I. -I.. -I$(INCDIR)/efi -I$(INCDIR)/efi/$(ARCH) \
|
||||
|
||||
CFLAGS += -mno-mmx -mno-sse -mno-sse2 -mno-80387 -mno-fp-ret-in-387
|
||||
|
||||
CFLAGS += -fno-delete-null-pointer-checks -fwrapv
|
||||
ifeq ($(ARCH),ia32)
|
||||
ifeq ($(HOST),x86_64)
|
||||
CFLAGS += -m32
|
||||
|
@ -10,6 +10,7 @@ LIFEMNGR_CFLAGS += -Wall -ffunction-sections
|
||||
LIFEMNGR_CFLAGS += -Werror
|
||||
LIFEMNGR_CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
|
||||
LIFEMNGR_CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
|
||||
LIFEMNGR_CFLAGS += -fno-delete-null-pointer-checks -fwrapv
|
||||
LIFEMNGR_CFLAGS += -fpie -fpic
|
||||
LIFEMNGR_CFLAGS += $(CFLAGS)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user