From 4dc549e58b6ebf63554cd466d5ceb0e9c70ab859 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sun, 20 Apr 2014 10:50:00 +0200 Subject: perf tools: Disable libdw unwind for all but x86 arch So far there's only x86 libdw unwind support merged in perf. Disable it on all other architectures in case libdw unwind support is detected in system. Cc: Arnaldo Carvalho de Melo Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Jean Pihet Cc: Josh Boyer Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1397988006-14158-1-git-send-email-jolsa@redhat.com Signed-off-by: Jiri Olsa --- tools/perf/config/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/perf/config/Makefile') diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index ee21fa95ebcf..a71fb395e38f 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -34,6 +34,14 @@ ifeq ($(ARCH),arm) LIBUNWIND_LIBS = -lunwind -lunwind-arm endif +# So far there's only x86 libdw unwind support merged in perf. +# Disable it on all other architectures in case libdw unwind +# support is detected in system. Add supported architectures +# to the check. +ifneq ($(ARCH),x86) + NO_LIBDW_DWARF_UNWIND := 1 +endif + ifeq ($(LIBUNWIND_LIBS),) NO_LIBUNWIND := 1 else -- cgit v1.2.1 From 2cf9040714f3e63f94935c9f1ed4e5bc54265ddb Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Wed, 23 Apr 2014 16:53:25 +0200 Subject: perf tools: Fix bfd dependency libraries detection There's false assumption in the library detection code assuming -liberty and -lz are always present once bfd is detected. The fails on Ubuntu (14.04) as reported by Ingo. Forcing the bdf dependency libraries detection any time bfd library is detected. Reported-by: Ingo Molnar Tested-by: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Corey Ashford Cc: David Ahern Cc: Frederic Weisbecker Cc: Ingo Molnar Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1398676935-6615-1-git-send-email-jolsa@kernel.org Signed-off-by: Jiri Olsa --- tools/perf/config/Makefile | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'tools/perf/config/Makefile') diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index a71fb395e38f..a57d59e7fe4b 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -194,7 +194,10 @@ VF_FEATURE_TESTS = \ stackprotector-all \ timerfd \ libunwind-debug-frame \ - bionic + bionic \ + liberty \ + liberty-z \ + cplus-demangle # Set FEATURE_CHECK_(C|LD)FLAGS-all for all CORE_FEATURE_TESTS features. # If in the future we need per-feature checks/flags for features not @@ -512,7 +515,21 @@ else endif ifeq ($(feature-libbfd), 1) - EXTLIBS += -lbfd -lz -liberty + EXTLIBS += -lbfd + + # call all detections now so we get correct + # status in VF output + $(call feature_check,liberty) + $(call feature_check,liberty-z) + $(call feature_check,cplus-demangle) + + ifeq ($(feature-liberty), 1) + EXTLIBS += -liberty + else + ifeq ($(feature-liberty-z), 1) + EXTLIBS += -liberty -lz + endif + endif endif ifdef NO_DEMANGLE @@ -523,15 +540,10 @@ else CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else ifneq ($(feature-libbfd), 1) - $(call feature_check,liberty) - ifeq ($(feature-liberty), 1) - EXTLIBS += -lbfd -liberty - else - $(call feature_check,liberty-z) - ifeq ($(feature-liberty-z), 1) - EXTLIBS += -lbfd -liberty -lz - else - $(call feature_check,cplus-demangle) + ifneq ($(feature-liberty), 1) + ifneq ($(feature-liberty-z), 1) + # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT + # or any of 'bfd iberty z' trinity ifeq ($(feature-cplus-demangle), 1) EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT -- cgit v1.2.1 From 6392b4ebdc1acfbed605d68c437ff5597d0a8d95 Mon Sep 17 00:00:00 2001 From: Mathias Krause Date: Sun, 27 Apr 2014 18:51:05 +0200 Subject: perf x86: Fix perf to use non-executable stack, again arch/x86/tests/regs_load.S is missing the linker note about the stack requirements, therefore making the linker fall back to an executable stack. As this object gets linked against the final perf binary, it'll needlessly end up with an executable stack. Fix this by adding the appropriate linker note. Also add a global linker flag to prevent future regressions, as suggested by Jiri. This way perf won't get an executable stack even if we fail to add the .GNU-stack linker note to future assembler files. Though, doing so might create regressions the other way around, when (statically) linking against libraries needing an executable stack. But, apparently, regressing in that direction is wanted as it is an indicator of poor code quality -- or just missing linker notes. Fixes: 3c8b06f981 ("perf tests x86: Introduce perf_regs_load function") Signed-off-by: Mathias Krause Acked-by: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Paul Mackerras Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1398617466-22749-1-git-send-email-minipli@googlemail.com Signed-off-by: Jiri Olsa --- tools/perf/config/Makefile | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/perf/config/Makefile') diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index a57d59e7fe4b..802cf544202b 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -117,6 +117,10 @@ CFLAGS += -Wall CFLAGS += -Wextra CFLAGS += -std=gnu99 +# Enforce a non-executable stack, as we may regress (again) in the future by +# adding assembler files missing the .GNU-stack linker note. +LDFLAGS += -Wl,-z,noexecstack + EXTLIBS = -lelf -lpthread -lrt -lm -ldl ifneq ($(OUTPUT),) -- cgit v1.2.1