Skip to content

Commit

Permalink
perf tools: check if -DFORTIFY_SOURCE=2 is allowed
Browse files Browse the repository at this point in the history
It seems gcc (4.7.2) defines _FORTIFY_SOURCE internally and becomes
confused when it sees another definition in flags.

For me, build failed like this:

CHK glibc
Makefile:548: *** No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static. Stop.

and only with V=1 it printed:

<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<stdin>:1:0: note: this is the location of the previous definition

Signed-off-by: Marcin Slusarz <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
mslusarz authored and acmel committed Mar 13, 2013
1 parent 5f7439e commit d2f3247
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/perf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ifeq ("$(origin DEBUG)", "command line")
PERF_DEBUG = $(DEBUG)
endif
ifndef PERF_DEBUG
CFLAGS_OPTIMIZE = -O6 -D_FORTIFY_SOURCE=2
CFLAGS_OPTIMIZE = -O6
endif

ifdef PARSER_DEBUG
Expand Down Expand Up @@ -180,6 +180,12 @@ ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-W
CFLAGS := $(CFLAGS) -Wvolatile-register-var
endif

ifndef PERF_DEBUG
ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
endif
endif

### --- END CONFIGURATION SECTION ---

ifeq ($(srctree),)
Expand Down

0 comments on commit d2f3247

Please sign in to comment.