Source: binutils Version: 2.27-8 Severity: important User: bal...@balintreczey.hu Usertags: pie-bindnow-20160906 Justification: makes ocaml FTBFS on amd64 with extra hardening Tags: patch Affects: ocaml
Dear Maintainers, During a rebuild of all packages in sid, ocaml failed to build on amd64 with patched GCC and dpkg. The root cause seems to be that libbfd.a is shipped as a non-PIC library. The rebuild tested if packages are ready for a transition enabling PIE and bindnow for amd64. For more information about the changes to sid's dpkg and GCC please visit: https://wiki.debian.org/Hardening/PIEByDefaultTransitio Relevant part of ocaml's build log: ... gcc -o objinfo_helper -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT \ objinfo_helper.c -Wl,-Bstatic -lbfd -Wl,-Bdynamic -ldl -liberty -lz /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libbfd.a(format.o): relocation R_X86_64_32S against symbol `binary_vec' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libbfd.a(hash.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libbfd.a(libbfd.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC ... The full build log is available from: https://people.debian.org/~rbalint/build-logs/pie-bindnow-20160906/ocaml_4.02.3-7_amd64.build.gz The attached patch fixed the problem. Thanks, Balint
diff -u binutils-2.27/debian/changelog binutils-2.27/debian/changelog --- binutils-2.27/debian/changelog +++ binutils-2.27/debian/changelog @@ -1,3 +1,10 @@ +binutils (2.27-8+rbalint0) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Build libbfd with -fPIC + + -- Balint Reczey <bal...@balintreczey.hu> Sat, 10 Sep 2016 15:53:07 +0200 + binutils (2.27-8) unstable; urgency=medium * Fix diversion updates for 32bit x86 targets. diff -u binutils-2.27/debian/patches/series binutils-2.27/debian/patches/series --- binutils-2.27/debian/patches/series +++ binutils-2.27/debian/patches/series @@ -12,6 +12,7 @@ 130_gold_disable_testsuite_build.patch 131_ld_bootstrap_testsuite.patch 135_bfd_version.patch +136_bfd_pic.patch 157_ar_scripts_with_tilde.patch #158_ld_system_root.patch 161_gold_dummy_zoption.diff only in patch2: unchanged: --- binutils-2.27.orig/debian/patches/136_bfd_pic.patch +++ binutils-2.27/debian/patches/136_bfd_pic.patch @@ -0,0 +1,25 @@ +Author: Balint Reczey <bal...@balintreczey.hu> +Description: Build libbfd with -fPIC to allow linking with PIE binaries + +--- ./bfd/Makefile.am.bak 2016-09-10 16:26:46.062371030 +0200 ++++ ./bfd/Makefile.am 2016-09-10 16:27:48.913724681 +0200 +@@ -51,7 +51,7 @@ + + WARN_CFLAGS = @WARN_CFLAGS@ + NO_WERROR = @NO_WERROR@ +-AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) ++AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) -fPIC + AM_CPPFLAGS = -DBINDIR='"$(bindir)"' + if PLUGINS + bfdinclude_HEADERS += $(INCDIR)/plugin-api.h +--- ./bfd/Makefile.in.bak 2016-09-10 16:26:53.009857349 +0200 ++++ ./bfd/Makefile.in 2016-09-10 16:27:31.886983240 +0200 +@@ -387,7 +387,7 @@ + # case both are empty. + ZLIB = @zlibdir@ -lz + ZLIBINC = @zlibinc@ +-AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) ++AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC) -fPIC + AM_CPPFLAGS = -DBINDIR='"$(bindir)"' + @PLUGINS_TRUE@LIBDL = @lt_cv_dlopen_libs@ +