From 9797d4119d5de6cb4db1aec928a79038dc3f066b Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Fri, 27 Sep 2019 00:35:47 -0500 Subject: Update URI pointing to libelf v0.8.13 The mirror for the version of libelf needed is down, preventing crossgcc from being built using the old build system. Resolves issues #664, #672 --- resources/libreboot/patch/crossgcc/libelf.patch | 25 +++++++++++++++++++++++++ resources/scripts/helpers/download/crossgcc | 2 ++ 2 files changed, 27 insertions(+) create mode 100644 resources/libreboot/patch/crossgcc/libelf.patch diff --git a/resources/libreboot/patch/crossgcc/libelf.patch b/resources/libreboot/patch/crossgcc/libelf.patch new file mode 100644 index 00000000..af954446 --- /dev/null +++ b/resources/libreboot/patch/crossgcc/libelf.patch @@ -0,0 +1,25 @@ +From e2896721cff5af4d869a7c900e748c803f25a2ce Mon Sep 17 00:00:00 2001 +From: Andrew Robbins +Date: Thu, 26 Sep 2019 18:19:07 -0500 +Subject: [PATCH] buildgcc: Replace dead libelf archive URI + +--- + util/crossgcc/buildgcc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc +index 97c38b8d95..54f87972e6 100755 +--- a/util/crossgcc/buildgcc ++++ b/util/crossgcc/buildgcc +@@ -57,7 +57,7 @@ MAKE_VERSION=4.2.1 + GMP_ARCHIVE="http://ftpmirror.gnu.org/gmp/gmp-${GMP_VERSION}.tar.xz" + MPFR_ARCHIVE="http://ftpmirror.gnu.org/mpfr/mpfr-${MPFR_VERSION}.tar.xz" + MPC_ARCHIVE="http://ftpmirror.gnu.org/mpc/mpc-${MPC_VERSION}.tar.gz" +-LIBELF_ARCHIVE="http://www.mr511.de/software/libelf-${LIBELF_VERSION}.tar.gz" ++LIBELF_ARCHIVE="https://fossies.org/linux/misc/old/libelf-${LIBELF_VERSION}.tar.gz" + GCC_ARCHIVE="http://ftpmirror.gnu.org/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.bz2" + BINUTILS_ARCHIVE="http://ftpmirror.gnu.org/binutils/binutils-${BINUTILS_VERSION}.tar.bz2" + GDB_ARCHIVE="http://ftpmirror.gnu.org/gdb/gdb-${GDB_VERSION}.tar.xz" +-- +2.23.0 + diff --git a/resources/scripts/helpers/download/crossgcc b/resources/scripts/helpers/download/crossgcc index 54f55439..5469c866 100755 --- a/resources/scripts/helpers/download/crossgcc +++ b/resources/scripts/helpers/download/crossgcc @@ -49,6 +49,8 @@ rm -Rf "crossgcc/" # workaround to fix the error on debian stretch and later, when building # GMP. If -pie is enabled in GCC, then --with-pic must be used when compiling git am ../resources/libreboot/patch/crossgcc/gccfix.diff + # Update URI pointing to the version of libelf we need + git am ../resources/libreboot/patch/crossgcc/libelf.patch #Patch to add hash checking to buildgcc git apply ../resources/libreboot/patch/crossgcc/buildgcc_hash_patch.diff rm -Rf .git* */*/.git* -- cgit v1.2.3-70-g09d2 From f2c648593a094b8f28af633fd2bc145d5c97d039 Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Fri, 27 Sep 2019 09:40:12 -0500 Subject: Use '--with-pic' if building gmp with '-pie' The updated regex catches more instances where '-pie' would be enabled. Parabola's gcc is built with a spec string which causes issues when building gmp (as part of the crossgcc build process) using the old build system. --- resources/libreboot/patch/crossgcc/gccfix.diff | 27 ------------------ .../libreboot/patch/crossgcc/looking_for_pie.patch | 32 ++++++++++++++++++++++ resources/scripts/helpers/download/crossgcc | 5 ++-- 3 files changed, 34 insertions(+), 30 deletions(-) delete mode 100644 resources/libreboot/patch/crossgcc/gccfix.diff create mode 100644 resources/libreboot/patch/crossgcc/looking_for_pie.patch diff --git a/resources/libreboot/patch/crossgcc/gccfix.diff b/resources/libreboot/patch/crossgcc/gccfix.diff deleted file mode 100644 index 49e6227b..00000000 --- a/resources/libreboot/patch/crossgcc/gccfix.diff +++ /dev/null @@ -1,27 +0,0 @@ -From ea0c2d76c4f16eccaafcb2c0741f76825505bafc Mon Sep 17 00:00:00 2001 -From: Nico Huber -Date: Thu, 22 Dec 2016 16:05:54 +0100 -Subject: [PATCH] DONOTMERGE buildgcc: Build GMP `--with-pic` if GCC defaults to `-pie` - -Change-Id: I5f3185af9c8d599379a628e18724b217b88be974 -Signed-off-by: Nico Huber ---- - -diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc -index 97c38b8..4eefd43 100755 ---- a/util/crossgcc/buildgcc -+++ b/util/crossgcc/buildgcc -@@ -515,6 +515,13 @@ - } - - build_GMP() { -+ # Check if GCC enables `-pie` by default (likely on Debian Stretch). -+ # We have to use `--with-pic` 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 diff --git a/resources/libreboot/patch/crossgcc/looking_for_pie.patch b/resources/libreboot/patch/crossgcc/looking_for_pie.patch new file mode 100644 index 00000000..942edac2 --- /dev/null +++ b/resources/libreboot/patch/crossgcc/looking_for_pie.patch @@ -0,0 +1,32 @@ +From e64fb0ce10d01d99154fb4bd95529e5cd8dfd4be Mon Sep 17 00:00:00 2001 +From: Andrew Robbins +Date: Fri, 27 Sep 2019 09:38:09 -0500 +Subject: [PATCH] buildgcc: Check for '-pie' when building gmp + +The regex formerly used was not flexible enough to catch some +instances where the '-pie' flag would be enabled. +--- + util/crossgcc/buildgcc | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc +index 97c38b8d95..a6e4728514 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:]]*\(!no-pie\)\?:-pie\>' ++ then ++ OPTIONS="$OPTIONS --with-pic" ++ fi ++ + CC="$CC" ../${GMP_DIR}/configure --disable-shared --enable-fat \ + --prefix=$TARGETDIR $OPTIONS \ + || touch .failed +-- +2.23.0 + diff --git a/resources/scripts/helpers/download/crossgcc b/resources/scripts/helpers/download/crossgcc index 5469c866..8522458a 100755 --- a/resources/scripts/helpers/download/crossgcc +++ b/resources/scripts/helpers/download/crossgcc @@ -46,9 +46,8 @@ rm -Rf "crossgcc/" cd 3rdparty/vboot/ git reset --hard ${vbootrevision} ) - # workaround to fix the error on debian stretch and later, when building - # GMP. If -pie is enabled in GCC, then --with-pic must be used when compiling - git am ../resources/libreboot/patch/crossgcc/gccfix.diff + # If -pie is enabled in GCC, then --with-pic must be used when compiling + git am ../resources/libreboot/patch/crossgcc/looking_for_pie.patch # Update URI pointing to the version of libelf we need git am ../resources/libreboot/patch/crossgcc/libelf.patch #Patch to add hash checking to buildgcc -- cgit v1.2.3-70-g09d2