On Sat, 29 Oct 2016 11:14:49 +0100 Chris Lamb <la...@debian.org> wrote:
[...]
>   FAIL: sign-verify.sh
>   FAIL: sign-verify-detached.sh
>   FAIL: sign-detach-verify.sh
>   FAIL: sign-attach-verify.sh
>   PASS: sign-missing-image.sh
>   PASS: sign-missing-cert.sh
>   PASS: sign-missing-key.sh
>   PASS: verify-missing-image.sh
>   FAIL: verify-missing-cert.sh
>   PASS: sign-invalidattach-verify.sh
>   FAIL: cert-table-header.sh
>   FAIL: resign-warning.sh
>   FAIL: reattach-warning.sh
>   FAIL: detach-remove.sh
>   ==========================================
>      sbsigntool 0.6: tests/test-suite.log
>   ==========================================
>   
>   # TOTAL: 14
>   # PASS:  5
>   # SKIP:  0
>   # XFAIL: 0
[...]

Andrey Rahmatullin <w...@debian.org> wrote:
> I get an even earlier error on an amd64 system:
> 
> make[4]: Entering directory '/<<PKGBUILDDIR>>/tests'
> gcc -m64 -Wdate-time -D_FORTIFY_SOURCE=2  -c -o test-x86_64.o test.S
> gcc  -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong 
> -Wformat -Werror=format-security  -nostdlib -T ./test-x86_64.lds -o 
> test-x86_64.elf test-x86_64.o
> /usr/bin/ld: test-x86_64.elf: Not enough room for program headers, try 
> linking with -N
[...]

With a current unstable system I can reproduce this, and if I use an
archive snapshot from 2016-10-29 I can reproduce the test failures
Chris got.

The problem seems to be that ld is attempting to set the dynamic linker
path in the header of a program that isn't meant to be dynamically
linked.  This seems like a bug in binutils, but in any case I've seen
it before and it can be solved by adding --no-dynamic-linker to the ld
command line.  This fixes the build failure and fixes the test failures
with the older toolchain.

I made an NMU to fix this, and am attaching the debdiff.

Ben.

-- 
Ben Hutchings
All the simple programs have been written, and all the good names
taken.
diff -Nru sbsigntool-0.6/debian/changelog sbsigntool-0.6/debian/changelog
--- sbsigntool-0.6/debian/changelog	2016-06-26 22:39:15.000000000 +0100
+++ sbsigntool-0.6/debian/changelog	2017-01-29 01:00:17.000000000 +0000
@@ -1,3 +1,10 @@
+sbsigntool (0.6-3.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix linker flags for test cases (Closes: #842446)
+
+ -- Ben Hutchings <b...@decadent.org.uk>  Sun, 29 Jan 2017 01:00:17 +0000
+
 sbsigntool (0.6-3.1) unstable; urgency=medium
 
   * Non-maintainer upload with approval of maintainer
diff -Nru sbsigntool-0.6/debian/patches/fix-linker-flags-for-test-cases.patch sbsigntool-0.6/debian/patches/fix-linker-flags-for-test-cases.patch
--- sbsigntool-0.6/debian/patches/fix-linker-flags-for-test-cases.patch	1970-01-01 01:00:00.000000000 +0100
+++ sbsigntool-0.6/debian/patches/fix-linker-flags-for-test-cases.patch	2017-01-29 01:00:17.000000000 +0000
@@ -0,0 +1,21 @@
+Author: Ben Hutchings <b...@decadent.org.uk>
+Date: Sun, 29 Jan 2017 00:25:50 +0000
+Description: Fix linker flags for test cases
+ We need to explicitly disable use of a dynamic linker.  When using
+ Debian's binutils 2.27-9, ld succeeds but appears to generate broken
+ headers that cause the tests to fail.  When using binutils 2.28, ld
+ fails, reporting "Not enough room for program headers, try linking
+ with -N".
+Bug-Debian: https://bugs.debian.org/842446
+
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -29,7 +29,7 @@ test-i386.pecoff: test_lds = $(srcdir)/t
+ test-i386.pecoff: ASFLAGS += -m32
+ test-i386.pecoff: LDFLAGS += -m32
+ 
+-test-%.elf: LDFLAGS = -nostdlib -T $(test_lds)
++test-%.elf: LDFLAGS = -nostdlib -T $(test_lds) -Wl,--no-dynamic-linker
+ test-%.elf: test-%.$(OBJEXT) $(test_lds)
+ 	$(LINK) $<
+ 
diff -Nru sbsigntool-0.6/debian/patches/series sbsigntool-0.6/debian/patches/series
--- sbsigntool-0.6/debian/patches/series	2016-06-26 21:55:38.000000000 +0100
+++ sbsigntool-0.6/debian/patches/series	2017-01-29 01:00:17.000000000 +0000
@@ -13,3 +13,4 @@
 sbsign_check_write_return.patch
 update-openssl-api-usage-to-support-openssl-1.1.patch
 fix-efi-arch-detection.patch
+fix-linker-flags-for-test-cases.patch

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to