[pkg-d-commits] [ldc] 03/04: Always re-bootstrap the new LDC using LDC 0.17.x

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:35:31 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to branch master
in repository ldc.

commit ecb05a480a009d49f552922713edae809b13c623
Author: Matthias Klumpp <mak at debian.org>
Date:   Sun Apr 23 23:22:35 2017 +0200

    Always re-bootstrap the new LDC using LDC 0.17.x
---
 debian/control                                |  1 -
 debian/gbp.conf                               |  5 ++---
 debian/patches/05_bootstrap-pic-default.patch | 31 +++++++++++++++++++++++++++
 debian/patches/series                         |  1 +
 debian/rules                                  | 15 +++++++++++--
 5 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index c2b58f8..e95c49b 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,6 @@ Uploaders: Konstantinos Margaritis <markos at debian.org>,
 Build-Depends: cmake,
                debhelper (>= 10),
                dh-exec (>= 0.3),
-               ldc | d-compiler | d-v2-compiler,
                libconfig++-dev,
                libconfig-dev,
                libcurl4-gnutls-dev,
diff --git a/debian/gbp.conf b/debian/gbp.conf
index 6dabebe..ce1181f 100644
--- a/debian/gbp.conf
+++ b/debian/gbp.conf
@@ -1,8 +1,7 @@
 [DEFAULT]
+upstream-branch = upstream
+components = [ 'bootstrap' ]
 pristine-tar = True
 
 [buildpackage]
 sign-tags = True
-
-[import-orig]
-dch = False
diff --git a/debian/patches/05_bootstrap-pic-default.patch b/debian/patches/05_bootstrap-pic-default.patch
new file mode 100644
index 0000000..b97ebd1
--- /dev/null
+++ b/debian/patches/05_bootstrap-pic-default.patch
@@ -0,0 +1,31 @@
+From d9496882163e173ea718756a7fb0cbc627c5326f Mon Sep 17 00:00:00 2001
+From: Matthias Klumpp <matthias at tenstral.net>
+Date: Tue, 2 Aug 2016 17:10:09 +0200
+Subject: [PATCH] Default to PIC code on Linux
+
+Modern Linux distributions have their toolchain generate PIC code for
+additional security features (like ASLR).
+Since there is no (sane) way to detect whether the toolchain defaults to
+PIC code, we simply default to PIC code on all Linux
+distributions to avoid linking issues on these OSes.
+
+The relocation model can be switched back to non-PIC code manually at
+any time.
+---
+ driver/targetmachine.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/bootstrap/driver/targetmachine.cpp
++++ b/bootstrap/driver/targetmachine.cpp
+@@ -524,7 +524,10 @@
+       // Darwin defaults to PIC (and as of 10.7.5/LLVM 3.1-3.3, TLS use leads
+       // to crashes for non-PIC code). LLVM doesn't handle this.
+       relocModel = llvm::Reloc::PIC_;
+-    } else if (triple.getEnvironment() == llvm::Triple::Android) {
++    } else if (triple.isOSLinux()) {
++      // Modern Linux distributions have their toolchain generate PIC code for additional security
++      // features (like ASLR). We default to PIC code to avoid linking issues on these OSes.
++      // On Android, PIC is default as well.
+       relocModel = llvm::Reloc::PIC_;
+     } else {
+       // ARM for other than Darwin or Android defaults to static
diff --git a/debian/patches/series b/debian/patches/series
index 46e953c..cad82c0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 02_ldc_include_path.diff
 03_static-PIC.patch
 04_pass-d-compiler-flags.patch
+05_bootstrap-pic-default.patch
diff --git a/debian/rules b/debian/rules
index 1d0e9fb..80f5bdb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,16 +14,27 @@ ifeq ($(DEB_HOST_ARCH),armhf)
 LDC_BUILD_FLAGS += -DD_COMPILER_FLAGS=-mattr=-neon
 endif
 
+BOOTSTRAP_LDC_DIR := $(CURDIR)/bootstrap
+BOOTSTRAP_LDC_BUILD_DIR := $(BOOTSTRAP_LDC_DIR)/b
 
 %:
 	dh $@ --parallel
 
 override_dh_auto_configure:
+	# Build the C++-only old compiler for bootstrapping
+	dh_auto_configure -D$(BOOTSTRAP_LDC_DIR) -B$(BOOTSTRAP_LDC_BUILD_DIR) -- -DD_FLAGS=-w\;-relocation-model=pic
+	dh_auto_build -B$(BOOTSTRAP_LDC_BUILD_DIR)
+
+	# Configure the actual LDC version
 	[ -d build-static ] || mkdir build-static
-	dh_auto_configure -D$(CURDIR) -B$(CURDIR)/build-static -- -DBUILD_SHARED_LIBS=OFF $(LDC_BUILD_FLAGS)
+	dh_auto_configure -B$(CURDIR)/build-static -- \
+			-DD_COMPILER=$(BOOTSTRAP_LDC_BUILD_DIR)/bin/ldmd2 \
+			-DBUILD_SHARED_LIBS=OFF $(LDC_BUILD_FLAGS)
 
 	[ -d build-shared ] || mkdir build-shared
-	dh_auto_configure -D$(CURDIR) -B$(CURDIR)/build-shared -- -DBUILD_SHARED_LIBS=ON $(LDC_BUILD_FLAGS)
+	dh_auto_configure -B$(CURDIR)/build-shared -- \
+			-DD_COMPILER=$(BOOTSTRAP_LDC_BUILD_DIR)/bin/ldmd2 \
+			-DBUILD_SHARED_LIBS=ON $(LDC_BUILD_FLAGS)
 
 override_dh_auto_build:
 	dh_auto_build -Bbuild-static

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list