grub2/0167-Try-to-set-fPIE-and-friends-on-libgnu.a.patch
Petr Šabata 100e37f2e6 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/grub2#f7e054f3d693af43a903faf33b70673f7aca4508
2020-10-15 09:48:35 +02:00

41 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
}