[PATCH] Automatically determine if -fuse-ld=gold is supported based on binutils package version.

Jon Severinsson jon at severinsson.net
Sat Aug 31 07:35:42 UTC 2013


(backported from 3.3 branch to 3.2 branch)
---
 debian/changelog |    1 +
 debian/control   |    3 +--
 debian/rules     |    8 ++++++++
 3 filer ändrade, 10 tillägg(+), 2 borttagningar(-)

diff --git a/debian/changelog b/debian/changelog
index 4381cac9..640d921b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ llvm-toolchain-3.2 (1:3.2repack-12) UNRELEASED; urgency=low
   [ Jon Severinsson ]
   * Drop auto-generated file debian/libllvm3.2.install.
   * Automatically determine GCC_VERSION and dep:devlibs based on g++ package version.
+  * Automatically determine if -fuse-ld=gold is supported based on binutils package version.
 
  -- Jon Severinsson <jon at severinsson.net>  Wed, 28 Aug 2013 18:00:00 +0200
 
diff --git a/debian/control b/debian/control
index 8e2a885e..e857174b 100644
--- a/debian/control
+++ b/debian/control
@@ -8,8 +8,7 @@ Build-Depends: debhelper (>= 9.0), flex, bison, dejagnu, tcl8.5, expect,
     sharutils, autotools-dev (>= 20060702.1), libffi-dev (>= 3.0.9),
     lsb-release, patchutils, diffstat, xz-utils, chrpath, python-dev,
     libedit-dev, swig, python-sphinx, ocaml-nox, binutils-dev, libcloog-isl-dev,
-    libisl-dev (>= 0.11.1), binutils-gold [amd64 armhf i386 x32],
-    libjsoncpp-dev
+    libisl-dev (>= 0.11.1), libjsoncpp-dev
 Build-Conflicts: oprofile, ocaml
 Standards-Version: 3.9.4
 Homepage: http://www.llvm.org/
diff --git a/debian/rules b/debian/rules
index 6648d339..9e349d21 100755
--- a/debian/rules
+++ b/debian/rules
@@ -46,6 +46,14 @@ else
 	control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev'
 endif
 
+BINUTILS_GOLD_ARCHS := amd64 armhf i386 x32
+ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) ge 2.23.1-1~exp3 ; echo $$?),0)
+ifneq (,$(findstring $(DEB_HOST_ARCH),$(BINUTILS_GOLD_ARCHS)))
+# -fused-ld=gold enables the gold linker (but is not supported by all archs / distro)
+	LDFLAGS_EXTRA += -fuse-ld=gold
+endif
+endif
+
 LLDB_ARCHS :=
 LLDB_ENABLE=no
 ifneq (,$(findstring $(DEB_HOST_ARCH),$(LLDB_ARCHS)))
-- 
1.7.10.4




More information about the Pkg-llvm-team mailing list