[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/01: t: Make test work when compiler uses -fPIE by default



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

nthykier pushed a commit to branch master
in repository lintian.

commit c295795e5f66b9c650f9d2c1f5f199b759263d6c
Author: Adam Conrad <adconrad@ubuntu.com>
Date:   Sat Jul 9 09:32:24 2016 +0000

    t: Make test work when compiler uses -fPIE by default
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 debian/changelog                           | 2 ++
 t/tests/binaries-general/debian/Makefile   | 3 +++
 t/tests/binaries-hardening/debian/Makefile | 7 +++++--
 t/tests/binaries-libc-link/debian/Makefile | 9 ++++++---
 t/tests/legacy-debug/debian/debian/rules   | 9 ++++++---
 5 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 73b161f..e1f9e8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -65,6 +65,8 @@ lintian (2.5.46) UNRELEASED; urgency=medium
   * t:
     + [JW,NT] Update tests to work now that dpkg validates
       debian/tests/control.  (Closes: #829635)
+    + [NT] Apply patch from Adam Conrad to make some tests work
+      when the compiler uses -fPIE by default.
 
  -- Niels Thykier <niels@thykier.net>  Sun, 19 Jun 2016 20:17:52 +0000
 
diff --git a/t/tests/binaries-general/debian/Makefile b/t/tests/binaries-general/debian/Makefile
index 387c368..1a90284 100644
--- a/t/tests/binaries-general/debian/Makefile
+++ b/t/tests/binaries-general/debian/Makefile
@@ -1,3 +1,6 @@
+# turn off PIE in CC in case we have a PIEful toolchain:
+CC := gcc -fno-pie -no-pie
+
 NOPIE_CFLAGS = $(filter-out -fPIE,$(CFLAGS))
 NOPIE_LDFLAGS = $(filter-out -fPIE -pie,$(LDFLAGS))
 COMPILE:= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
diff --git a/t/tests/binaries-hardening/debian/Makefile b/t/tests/binaries-hardening/debian/Makefile
index 723e7f1..0a9b764 100644
--- a/t/tests/binaries-hardening/debian/Makefile
+++ b/t/tests/binaries-hardening/debian/Makefile
@@ -1,11 +1,14 @@
+# turn off PIE in CC in case we have a PIEful toolchain:
+CC := gcc -fno-pie -no-pie
+
 all: weak.1 strong.1
 	# Build without dpkg-buildflags.
-	gcc -o weak -g \
+	$(CC) -o weak -g \
 		-fno-stack-protector \
 		-Wl,-z,norelro \
 		-U_FORTIFY_SOURCE \
 		hello.c
-	gcc -o strong \
+	$(CC) -o strong \
 		$(shell dpkg-buildflags --get CPPFLAGS) \
 		$(shell dpkg-buildflags --get CFLAGS) \
 		$(shell dpkg-buildflags --get LDFLAGS) \
diff --git a/t/tests/binaries-libc-link/debian/Makefile b/t/tests/binaries-libc-link/debian/Makefile
index 2d043e9..ed35a20 100644
--- a/t/tests/binaries-libc-link/debian/Makefile
+++ b/t/tests/binaries-libc-link/debian/Makefile
@@ -1,3 +1,6 @@
+# turn off PIE in CC in case we have a PIEful toolchain:
+CC := gcc -fno-pie -no-pie
+
 LINKER_FLAGS := -Wl,--no-copy-dt-needed-entries,--no-as-needed
 
 all: basic basic.1 libbasic-nodeps libbasic-nolibc
@@ -6,13 +9,13 @@ basic.1: basic.pod
 	pod2man --section 1 $< > $@
 
 basic: basic.o
-	gcc -nostdlib -o$@ $< $(LINKER_FLAGS) -lm $(LFLAGS)
+	$(CC) -nostdlib -o$@ $< $(LINKER_FLAGS) -lm $(LFLAGS)
 
 libbasic-nodeps: basic.o
-	gcc -nostdlib --shared -o$@ $<
+	$(CC) -nostdlib --shared -o$@ $<
 
 libbasic-nolibc: basic.o
-	gcc -nostdlib --shared -o$@ $< $(LINKER_FLAGS) -lm
+	$(CC) -nostdlib --shared -o$@ $< $(LINKER_FLAGS) -lm
 
 install:
 	install -d $(DESTDIR)/usr/bin
diff --git a/t/tests/legacy-debug/debian/debian/rules b/t/tests/legacy-debug/debian/debian/rules
index da46b7f..4b1ac55 100755
--- a/t/tests/legacy-debug/debian/debian/rules
+++ b/t/tests/legacy-debug/debian/debian/rules
@@ -4,16 +4,19 @@
 
 #export DH_COMPAT := 5
 
+# turn off PIE in CC in case we have a PIEful toolchain:
+CC := gcc -fno-pie -no-pie
+
 build-indep:
 
 build-arch: build-stamp
 
 build-stamp:
 	dh_testdir
-	gcc -D_REENTRANT -fPIC -c libhello.c
-	gcc -o libhello.so.0.0 -shared -Wl,-soname,libhello.so.0 libhello.o
+	$(CC) -D_REENTRANT -fPIC -c libhello.c
+	$(CC) -o libhello.so.0.0 -shared -Wl,-soname,libhello.so.0 libhello.o
 	ln -s libhello.so.0.0 libhello.so
-	gcc -o hello hello.c -L. -lhello
+	$(CC) -o hello hello.c -L. -lhello
 	touch build-stamp
 
 build: build-arch build-indep

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


Reply to: