[coreboot-gerrit] Patch set updated for coreboot: buildgcc: Build GMP `--with-pic` if GCC defaults to `-pie`
Nico Huber (nico.h@gmx.de)
gerrit at coreboot.org
Fri Dec 23 16:49:24 CET 2016
Nico Huber (nico.h at gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17936
-gerrit
commit 31c3dfeff1571d328a8b647e33648c356f582d64
Author: Nico Huber <nico.huber at secunet.com>
Date: Thu Dec 22 16:05:54 2016 +0100
buildgcc: Build GMP `--with-pic` if GCC defaults to `-pie`
GCC 6 can optionally default to building all binaries as position
independent executables (PIE). This breaks linking against static
libraries that are compiled without position independent code (PIC).
Building GMP `--with-pic` in this case seems to be the least fragile
solution.
TEST=Run `make all` and `make BUILDGCC_OPTIONS=-b build-i386` in
util/crossgcc on Debian Stretch.
Change-Id: I5f3185af9c8d599379a628e18724b217b88be974
Signed-off-by: Nico Huber <nico.huber at secunet.com>
---
util/crossgcc/buildgcc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 97c38b8..30e2188 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -515,6 +515,13 @@ set_hostcflags_from_gmp() {
}
build_GMP() {
+ # Check if GCC enables `-pie` by default (possible since GCC 6).
+ # We need PIC in all static libraries then.
+ if "${CC}" -dumpspecs 2>/dev/null | grep -q '[{;][[:space:]]*:-pie\>'
+ then
+ OPTIONS="$OPTIONS --with-pic"
+ fi
+
CC="$CC" ../${GMP_DIR}/configure --disable-shared --enable-fat \
--prefix=$TARGETDIR $OPTIONS \
|| touch .failed
More information about the coreboot-gerrit
mailing list