lkml.org 
[lkml]   [2010]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] perf tools: Test if programs with -fstack-prtoector-all link
The -fstack-protector may need additional library to be present in
system thus it is not enough to test if compiler compiles program
but also whether linker links it thus "-c" flag has been removed

Signed-off-by: Michal Nazarewicz <m.nazarewicz@samsung.com>
---
tools/perf/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

As I was corss-compiling perf compiler handled -fstack-protector-all
nicely and so the flag has been added to CFLAGS however test for
presence of libelf failed because linker could not link with ssp_nonshared
library. Removing "-c" from the -fstack-protector-all test code fixed
problem by forcing linking and thus testing if not only compiler but the
whole toolchain supported stack protector.

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 652a470..223e5f5 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -250,7 +250,7 @@ PTHREAD_LIBS = -lpthread
# explicitly what architecture to check for. Fix this up for yours..
SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__

-ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -c -Werror -fstack-protector-all - -o /dev/null "$(QUIET_STDERR)" && echo y"), y)
+ifeq ($(shell sh -c "echo 'int foo(void) {char X[2]; return 3;}' | $(CC) -x c -Werror -fstack-protector-all - -o /dev/null "$(QUIET_STDERR)" && echo y"), y)
CFLAGS := $(CFLAGS) -fstack-protector-all
endif

--
1.6.5



\
 
 \ /
  Last update: 2010-01-11 14:53    [W:0.030 / U:1.576 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site