[PATCH] perf tools: Test if programs with -fstack-prtoector-all link

From: Michal Nazarewicz
Date: Mon Jan 11 2010 - 08:51:33 EST


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@xxxxxxxxxxx>
---
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/