build: enable -fno-common

This flag prevents the compiler from merging multiple tenative global
variable declarations (e.g. 'int i;' without an assignment) into a
single copy later.  In the default (-fcommon) mode, this allows multiple
definitions of an uninitialized global variable to be linked into a
single program without any warnings.

Change-Id: I0339012a7164dccd311ab1f62d11111d24529fbd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2017-01-19 10:21:20 -07:00
parent 96b1f7e078
commit 53bf2d0f91

View File

@ -64,6 +64,9 @@ COMMON_CFLAGS += -fPIC
# Enable stack buffer overflow checking
COMMON_CFLAGS += -fstack-protector
# Prevent accidental multiple definitions of global variables
COMMON_CFLAGS += -fno-common
# Enable full RELRO - no lazy relocation (resolve everything at load time).
# This allows the GOT to be made read-only early in the loading process.
LDFLAGS += -Wl,-z,relro,-z,now