Patchwork [Oneiric,Natty] UBUNTU: SAUCE: perf: Link libbfd statically

login
register
mail settings
Submitter Stefan Bader
Date Aug. 2, 2011, 9:38 a.m.
Message ID <1312277892-5468-2-git-send-email-stefan.bader@canonical.com>
Download mbox | patch
Permalink /patch/107868/
State New
Headers show

Comments

Stefan Bader - Aug. 2, 2011, 9:38 a.m.
From 6627258256c3e3af334d31acc589749d9c138cf4 Mon Sep 17 00:00:00 2001
From: Anders Kaseorg <andersk@mit.edu>
Date: Tue, 5 Jul 2011 20:13:40 -0400
Subject: [PATCH] UBUNTU: SAUCE: perf: Link libbfd statically

The binutils-dev package description forbids Debian packages from
linking libbfd dynamically, because that would lead to very strict
versioned dependencies, so that frequent rebuilds are required to keep
every package in sync with current binutils.  It would also make it
impossible to install multiple versions of linux-tools linked against

Patch

different binutils versions.

BugLink: https://bugs.launchpad.net/bugs/783660

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
[v2: Changed to modify EXTLIBS]
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
---
 tools/perf/Makefile |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 940257b..61cd6cc 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -564,20 +564,21 @@  else
 		EXTLIBS += -liberty
 		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
         else
-		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lbfd
+		LIBBFD := $(shell $(CC) -print-file-name=libbfd.a)
+		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBBFD)
 		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD))
 		ifeq ($(has_bfd),y)
-			EXTLIBS += -lbfd
+			EXTLIBS += $(LIBBFD)
 		else
 			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
 			has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY))
 			ifeq ($(has_bfd_iberty),y)
-				EXTLIBS += -lbfd -liberty
+				EXTLIBS += $(LIBBFD) -liberty
 			else
 				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
 				has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z))
 				ifeq ($(has_bfd_iberty_z),y)
-					EXTLIBS += -lbfd -liberty -lz
+					EXTLIBS += $(LIBBFD) -liberty -lz
 				else
 					FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
 					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE))