Skip to contentSkip to conversation

perf tools: Do not use _FORTIFY_SOURCE when DEBUG=1 is specified

tip:perf/urgent tip-bot for Arnaldo Carvalho de Melo 1 participant 1 message May 30, 2012 perf events

lore
Share & tools
lore
#0 lore raw
Commit-ID:  a83eb3ea97efbc891b2f67e91329638cd4e21622
Gitweb:     http://git.kernel.org/tip/a83eb3ea97efbc891b2f67e91329638cd4e21622
Author:     Arnaldo Carvalho de Melo <[email protected]>
AuthorDate: Thu, 24 May 2012 14:48:39 -0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 24 May 2012 14:48:39 -0300

perf tools: Do not use _FORTIFY_SOURCE when DEBUG=1 is specified

As:

make DEBUG=1 -C tools/perf

disables optimizations and _FORTIFY_SOURCE in recent distros requires optimizations to be enabled, seen on a Fedora 17 system:

[acme@Fedora17 linux]$ make DEBUG=1 O=/home/acme/git/build/perf/ -C tools/perf install
In file included from /usr/include/sys/types.h:26:0,

                 from /usr/include/libelf.h:53,
                 from /usr/include/gelf.h:53,
                 from /usr/include/elfutils/libdw.h:53,
                 from <stdin>:2:

/usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp

Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/Makefile +2 -2
index 1d3d513..0eee64c 100644
@@ -80,7 +80,7 @@ ifeq ("$(origin DEBUG)", "command line")
   PERF_DEBUG = $(DEBUG)
 endif
 ifndef PERF_DEBUG
-  CFLAGS_OPTIMIZE = -O6
+  CFLAGS_OPTIMIZE = -O6 -D_FORTIFY_SOURCE=2
 endif
 
 ifdef PARSER_DEBUG
@@ -89,7 +89,7 @@ ifdef PARSER_DEBUG
 	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
 endif
 
-CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
+CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
 EXTLIBS = -lpthread -lrt -lelf -lm
 ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 ALL_LDFLAGS = $(LDFLAGS)