Skip to content

Commit

Permalink
Makefile: undefine _FORTIFY_SOURCE prior using it
Browse files Browse the repository at this point in the history
Currently, we are enforcing the _FORTIFY_SOURCE=2 without any
previous detection if the macro has been already defined, e.g.
by environment, or is just enabled by compiler by default on
some distributions (e.g. Gentoo).

This could result in the error like this:
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition

Tracked-On: #2344
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
  • Loading branch information
tw4452852 authored and wenlingz committed Feb 28, 2019
1 parent 3b2784e commit 33ecdd7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion devicemodel/Makefile
Expand Up @@ -16,7 +16,7 @@ CFLAGS += -DNO_OPENSSL
CFLAGS += -m64
CFLAGS += -Wall -ffunction-sections
CFLAGS += -Werror
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
CFLAGS += -fpie

Expand Down
2 changes: 1 addition & 1 deletion tools/acrn-crashlog/Makefile
Expand Up @@ -18,7 +18,7 @@ CFLAGS += -D_GNU_SOURCE
CFLAGS += -m64
CFLAGS += -Wall -ffunction-sections
CFLAGS += -Werror
CFLAGS += -O2 -D_FORTIFY_SOURCE=2
CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
CFLAGS += -fpie
CFLAGS += -Wall -Wextra -pedantic
Expand Down
2 changes: 1 addition & 1 deletion tools/acrn-manager/Makefile
Expand Up @@ -9,7 +9,7 @@ MANAGER_CFLAGS += -DNO_OPENSSL
MANAGER_CFLAGS += -m64
MANAGER_CFLAGS += -Wall -ffunction-sections
MANAGER_CFLAGS += -Werror
MANAGER_CFLAGS += -O2 -D_FORTIFY_SOURCE=2
MANAGER_CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
MANAGER_CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
MANAGER_CFLAGS += -fpie -fpic
#FIXME: remove me. work-around for system() calls, which will be removed
Expand Down
2 changes: 1 addition & 1 deletion tools/acrnlog/Makefile
Expand Up @@ -8,7 +8,7 @@ LOG_CFLAGS += -DNO_OPENSSL
LOG_CFLAGS += -m64
LOG_CFLAGS += -Wall -ffunction-sections
LOG_CFLAGS += -Werror
LOG_CFLAGS += -O2 -D_FORTIFY_SOURCE=2
LOG_CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
LOG_CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
LOG_CFLAGS += -fpie -fpic
LOG_CFLAGS += $(CFLAGS)
Expand Down
2 changes: 1 addition & 1 deletion tools/acrntrace/Makefile
Expand Up @@ -8,7 +8,7 @@ TRACE_CFLAGS += -DNO_OPENSSL
TRACE_CFLAGS += -m64
TRACE_CFLAGS += -Wall -ffunction-sections
TRACE_CFLAGS += -Werror
TRACE_CFLAGS += -O2 -D_FORTIFY_SOURCE=2
TRACE_CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
TRACE_CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing
TRACE_CFLAGS += -fpie -fpic
TRACE_CFLAGS += $(CFLAGS)
Expand Down

0 comments on commit 33ecdd7

Please sign in to comment.