As the -nopie option was something gentoo patched into gcc via the pie patches
used for hardened, and these patches are not applied to gcc6, the no-pie
patch used with grub:0 needs to be adjusted to hse the new flag when a newer
gcc is used.
Package-Manager: Portage-2.3.8, Repoman-2.3.3
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# XXX: we need to review menu.lst vs grub.conf handling. We've been converting
"${S}"/grub/asmstub.c \
|| die
+ # gcc-6 and above doesnt have a '-nopie' option patched in, use upstream's -no-pie
+ if (( $(gcc-major-version) > 5 )); then
+ sed -i 's/-nopie/-no-pie/' \
+ "${WORKDIR}"/patch/860_all_grub-0.97-pie.patch \
+ || die
+ fi
+
EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
# bug 564890, 566638
epatch "${FILESDIR}"/grub-0.97-Add-esp-to-list-of-clobbered-registers.patch