perf tools: Support static linking with libdw
authorAndi Kleen <ak@linux.intel.com>
Wed, 12 Aug 2015 22:48:37 +0000 (15:48 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 13 Aug 2015 17:49:11 +0000 (14:49 -0300)
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@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1439419717-20601-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/build/feature/Makefile
tools/perf/config/Makefile

index 1c0d69f445524ed75b61dd1ad9d9dcfa9bcfb1d9..74ca42093d70d72fac5a4b1776237be9873f480a 100644 (file)
@@ -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
index 823195aa6d4b6e53bfe3a9693e11568809fe8236..827557fc751123bf030363d355b5b801911d6cb1 100644 (file)
@@ -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