[PATCH 01/14] perf tools: Support static linking with libdw

From: Arnaldo Carvalho de Melo
Date: Mon Aug 17 2015 - 15:13:32 EST


From: Andi Kleen <ak@xxxxxxxxxxxxxxx>

The Fedora 22 version of libdw requires a couple of extra libraries to
link. With a dynamic link the dependencies are pulled in automatically,
but this doesn't work for static linking. Add the needed libraries
explicitely to the feature probe and the Makefile.

v2: Explicitly check for static linking and only add the dependencies
when -static is set. This is to avoid regressions on Arnaldo's system.

Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Link: http://lkml.kernel.org/r/1439419717-20601-1-git-send-email-andi@xxxxxxxxxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/build/feature/Makefile | 7 ++++++-
tools/perf/config/Makefile | 6 +++++-
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 1c0d69f44552..74ca42093d70 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -70,8 +70,13 @@ test-libelf.bin:
test-glibc.bin:
$(BUILD)

+DWARFLIBS := -ldw
+ifeq ($(findstring -static,${LDFLAGS}),-static)
+DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
+endif
+
test-dwarf.bin:
- $(BUILD) -ldw
+ $(BUILD) $(DWARFLIBS)

test-libelf-mmap.bin:
$(BUILD) -lelf
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 823195aa6d4b..827557fc7511 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -297,7 +297,11 @@ ifndef NO_LIBELF
else
CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
- EXTLIBS += -ldw
+ DWARFLIBS := -ldw
+ ifeq ($(findstring -static,${LDFLAGS}),-static)
+ DWARFLIBS += -lelf -lebl -lz -llzma -lbz2
+ endif
+ EXTLIBS += ${DWARFLIBS}
$(call detected,CONFIG_DWARF)
endif # PERF_HAVE_DWARF_REGS
endif # NO_DWARF
--
2.1.0

--
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/