[PATCH] perf tools: Fix static building

From: Alexey Brodkin
Date: Mon Aug 22 2016 - 13:35:56 EST


With commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols
used by traceevent plugins") we started to add "--dynamic-list" in
LDFLAGS. One side-effect of that was inability to build really
statically-linked perf.

I.e. even if "LDFLAGS=-static" were passed on perf building command-line
it had no effect and perf was built dynamically.

This change disables setup of "--dynamic-list" if LDFLAGS contains
"-static" option.

Signed-off-by: Alexey Brodkin <abrodkin@xxxxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Vineet Gupta <vgupta@xxxxxxxxxxxx>
Cc: Wang Nan <wangnan0@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: He Kuang <hekuang@xxxxxxxxxx>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
---
tools/perf/Makefile.perf | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 2d908750..e9acc7c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -236,7 +236,9 @@ LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
export LIBTRACEEVENT

LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
+ifeq ($(filter -static,$(LDFLAGS)),)
LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS = -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
+endif

LIBAPI = $(API_PATH)libapi.a
export LIBAPI
--
2.7.4