grub2/0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch
Javier Martinez Canillas e1531466e1
Update to grub 2.04
This change updates grub to the 2.04 release. The new release changed how
grub is built, so the bootstrap and bootstrap.conf files have to be added
to the dist-git. Also, the gitignore file changed so it has to be updated.

Since the patches have been forward ported to 2.04, there's no need for a
logic to maintain a patch with the delta between the release and the grub
master branch. So the release-to-master.patch is dropped and no longer is
updated by the do-rebase script.

Also since gnulib isn't part of the grub repository anymore and cloned by
the boostrap tool, a gnulib tarball is included as other source file and
copied before calling the bootstrap tool. That way grub can be built even
in builders that only have access to the sources lookaside cache.

Resolves: rhbz#1727279

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
2019-08-15 08:04:53 +02:00

40 lines
1.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 12 Jul 2019 17:45:51 +0200
Subject: [PATCH] Try to set -fPIE and friends on libgnu.a
In order to make sure UTIL_CFLAGS and UTIL_LDFLAGS can correctly get
-Wl,-z,relro,-z,now , we need everything going in them to be built with at
least -fPIC (and preferably -fPIE) wherever we can, or else we get relocations
in some component object that can't be used with the link type that's being
used for the final ELF object.
So this makes sure libgnu.a gets built with HOST_CFLAGS and HOST_LDFLAGS,
which are what is later used to define UTIL_CFLAGS and UTIL_LDFLAGS, and
includes -fPIE.
Fixes an rpmdiff check.
Related: rhbz#1658500
Signed-off-by: Peter Jones <pjones@redhat.com>
[javierm: replace from bootstrap instead patching generated Makefile.am]
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
bootstrap.conf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/bootstrap.conf b/bootstrap.conf
index 8804d5beb89..29a6a3e90e2 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -82,6 +82,9 @@ bootstrap_post_import_hook () {
patch -d grub-core/lib/gnulib -p2 \
< "grub-core/lib/gnulib-patches/$patchname.patch"
done
+ for flagvar in CPPFLAGS CFLAGS; do
+ sed -i -e "s/^AM_$flagvar =/AM_$flagvar = \$(HOST_$flagvar)/" grub-core/lib/gnulib/Makefile.am
+ done
FROM_BOOTSTRAP=1 ./autogen.sh
set +e # bootstrap expects this
}