From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751692AbbHLWsw (ORCPT ); Wed, 12 Aug 2015 18:48:52 -0400 Received: from mga09.intel.com ([134.134.136.24]:19013 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750826AbbHLWsv (ORCPT ); Wed, 12 Aug 2015 18:48:51 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,664,1432623600"; d="scan'208";a="624361116" From: Andi Kleen To: acme@kernel.org Cc: linux-kernel@vger.kernel.org, jolsa@kernel.org, Andi Kleen Subject: [PATCH] perf, tools: Support static linking with libdw Date: Wed, 12 Aug 2015 15:48:37 -0700 Message-Id: <1439419717-20601-1-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 2.4.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen 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 --- 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 463ed8f..a8a5b7f 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -69,8 +69,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 094ddae..e376a45 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.4.3