]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Add GCC flags to Basetool build.
authorFeng, Bob C <bob.c.feng@intel.com>
Tue, 30 Apr 2019 11:07:01 +0000 (19:07 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Wed, 1 May 2019 02:21:56 +0000 (10:21 +0800)
BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1764

Some compiler flags restrict the compiler from making
arbitrary decisions while handling undefined C/C++ behaviors.
Therefore they can be used to fix some issues caused by undefined behavior.

For example, for GCC, the following flags are available:
-fno-delete-null-pointer-checks tells
the compiler NOT to assume that null pointer deference does not exist.
-fwrapv tells the compiler that signed overflow always wraps.

This patch is going to add these 2 build options to
BaseTool GCC build option.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
BaseTools/Source/C/Makefiles/header.makefile

index c2397b796c9a84af321bd51f4b9af234dd8e8d2c..eac295b4ddb82ad64210cc9ad2e54112d7232e1a 100644 (file)
@@ -71,7 +71,8 @@ ifeq ($(DARWIN),Darwin)
 BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \\r
 -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g\r
 else\r
-BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \\r
+BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fwrapv \\r
+-fno-delete-null-pointer-checks -Wall -Werror \\r
 -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \\r
 -Wno-unused-result -nostdlib -g\r
 endif\r