Fix coreboot build where gcc defaults to pie (issue #177)

See 8bbd596de6
This commit is contained in:
Francis Lam 2017-04-09 17:39:23 -04:00
parent 132d26de05
commit a39a24665c
No known key found for this signature in database
GPG Key ID: 0A59C698920806EB

View File

@ -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