From a39a24665c3369dc1dcdf9abc0300add3b5024ba Mon Sep 17 00:00:00 2001 From: Francis Lam Date: Sun, 9 Apr 2017 17:39:23 -0400 Subject: [PATCH] Fix coreboot build where gcc defaults to pie (issue #177) See https://github.com/coreboot/coreboot/commit/8bbd596de631adc8b677e69603e978b848eb1708 --- patches/coreboot-4.5.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/patches/coreboot-4.5.patch b/patches/coreboot-4.5.patch index c017cbc1..33bc04ad 100644 --- a/patches/coreboot-4.5.patch +++ b/patches/coreboot-4.5.patch @@ -493,3 +493,21 @@ index a2ca1c1..df80286 100644 + } +} + +diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc +index 4883754..1037fe0 100755 +--- a/util/crossgcc/buildgcc ++++ b/util/crossgcc/buildgcc +@@ -502,6 +502,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