Merge pull request #7203 from heitbaum/grub

grub: update to 2.06
This commit is contained in:
CvH 2023-03-05 21:37:49 +01:00 committed by GitHub
commit 990903654c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 143 additions and 2 deletions

View File

@ -2,8 +2,8 @@
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="grub"
PKG_VERSION="635ef55ed1252f92fe3bf70caefd185dcc507c43" # 2020-12-18
PKG_SHA256="e099d18bdeef5312765f20c6de3384ca9ff03f776f1c7632b1e4bc4d1715a961"
PKG_VERSION="2.06"
PKG_SHA256="660eaa2355a4045d8d0cdb5765169d1cad9912ec07873b86c9c6d55dbaa9dfca"
PKG_ARCH="x86_64"
PKG_LICENSE="GPLv3"
PKG_SITE="https://www.gnu.org/software/grub/index.html"

View File

@ -0,0 +1,87 @@
From be8eb0eed69f8bc9ac20837eae58e55218011880 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Mon, 28 Mar 2022 15:00:52 +0800
Subject: util/mkimage: Fix dangling pointer may be used error
The warning is real as long as dangling pointer to tmp_ may be used if
o32 and o64 are both NULL. However that is not going to happen and can
be ignored safely because the PE_OHDR is being used in a context that
either o32 or o64 must have been properly initialized. Sadly compiler
seems not to always optimize that unused tmp_ away so explicit
suppression remain needed here.
../util/mkimage.c: In function 'grub_install_generate_image':
../util/mkimage.c:1422:41: error: dangling pointer to 'tmp_' may be used [-Werror=dangling-pointer=]
1422 | PE_OHDR (o32, o64, header_size) = grub_host_to_target32 (header_size);
../util/mkimage.c:857:28: note: 'tmp_' declared here
857 | __typeof__((o64)->field) tmp_; \
| ^~~~
Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
util/mkimage.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/util/mkimage.c b/util/mkimage.c
index 21c2db7..43078c7 100644
--- a/util/mkimage.c
+++ b/util/mkimage.c
@@ -1383,6 +1383,10 @@ grub_install_generate_image (const char *dir, const char *prefix,
section = (struct grub_pe32_section_table *)(o64 + 1);
}
+#if __GNUC__ >= 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
PE_OHDR (o32, o64, header_size) = grub_host_to_target32 (header_size);
PE_OHDR (o32, o64, entry_addr) = grub_host_to_target32 (layout.start_address);
PE_OHDR (o32, o64, image_base) = 0;
@@ -1402,6 +1406,9 @@ grub_install_generate_image (const char *dir, const char *prefix,
/* The sections. */
PE_OHDR (o32, o64, code_base) = grub_host_to_target32 (vma);
PE_OHDR (o32, o64, code_size) = grub_host_to_target32 (layout.exec_size);
+#if __GNUC__ >= 12
+#pragma GCC diagnostic pop
+#endif
section = init_pe_section (image_target, section, ".text",
&vma, layout.exec_size,
image_target->section_align,
@@ -1411,10 +1418,17 @@ grub_install_generate_image (const char *dir, const char *prefix,
GRUB_PE32_SCN_MEM_READ);
scn_size = ALIGN_UP (layout.kernel_size - layout.exec_size, GRUB_PE32_FILE_ALIGNMENT);
+#if __GNUC__ >= 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
/* ALIGN_UP (sbat_size, GRUB_PE32_FILE_ALIGNMENT) is done earlier. */
PE_OHDR (o32, o64, data_size) = grub_host_to_target32 (scn_size + sbat_size +
ALIGN_UP (total_module_size,
GRUB_PE32_FILE_ALIGNMENT));
+#if __GNUC__ >= 12
+#pragma GCC diagnostic pop
+#endif
section = init_pe_section (image_target, section, ".data",
&vma, scn_size, image_target->section_align,
@@ -1445,8 +1459,15 @@ grub_install_generate_image (const char *dir, const char *prefix,
}
scn_size = layout.reloc_size;
+#if __GNUC__ >= 12
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
PE_OHDR (o32, o64, base_relocation_table.rva) = grub_host_to_target32 (vma);
PE_OHDR (o32, o64, base_relocation_table.size) = grub_host_to_target32 (scn_size);
+#if __GNUC__ >= 12
+#pragma GCC diagnostic pop
+#endif
memcpy (pe_img + raw_data, layout.reloc_section, scn_size);
init_pe_section (image_target, section, ".reloc",
&vma, scn_size, image_target->section_align,
--
cgit v1.1

View File

@ -0,0 +1,54 @@
--- a/grub-core/lib/gnulib-patches/fix-uninit-structure.patch 2021-03-12 15:09:51.000000000 +0000
+++ b/grub-core/lib/gnulib-patches/fix-uninit-structure.patch 1970-01-01 00:00:00.000000000 +0000
@@ -1,11 +0,0 @@
---- a/lib/regcomp.c 2020-10-22 13:49:06.770168928 +0000
-+++ b/lib/regcomp.c 2020-10-22 13:50:37.026528298 +0000
-@@ -3662,7 +3662,7 @@
- Idx alloc = 0;
- #endif /* not RE_ENABLE_I18N */
- reg_errcode_t ret;
-- re_token_t br_token;
-+ re_token_t br_token = {0};
- bin_tree_t *tree;
-
- sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
--- a/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch 2021-03-12 15:09:51.000000000 +0000
+++ b/grub-core/lib/gnulib-patches/fix-regcomp-uninit-token.patch 1970-01-01 00:00:00.000000000 +0000
@@ -1,15 +0,0 @@
---- a/lib/regcomp.c 2020-11-24 17:06:08.159223858 +0000
-+++ b/lib/regcomp.c 2020-11-24 17:06:15.630253923 +0000
-@@ -3808,11 +3808,7 @@
- create_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
- re_token_type_t type)
- {
-- re_token_t t;
--#if defined GCC_LINT || defined lint
-- memset (&t, 0, sizeof t);
--#endif
-- t.type = type;
-+ re_token_t t = { .type = type };
- return create_token_tree (dfa, left, right, &t);
- }
-
--- a/bootstrap.conf 2021-03-12 15:09:51.000000000 +0000
+++ b/bootstrap.conf 2021-04-19 13:22:41.000000000 +0000
@@ -16,7 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-GNULIB_REVISION=d271f868a8df9bbec29049d01e056481b7a1a263
+GNULIB_REVISION=ebaa53c5f1253974c6f23bb1500d8de198e84ab8
# gnulib modules used by this package.
# mbswidth is used by gnulib-fix-width.diff's changes to argp rather than
@@ -79,8 +79,8 @@
bootstrap_post_import_hook () {
set -e
- for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
- fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do
+ for patchname in fix-base64 fix-null-deref fix-null-state-deref \
+ fix-regexec-null-deref fix-unused-value fix-width no-abort; do
patch -d grub-core/lib/gnulib -p2 \
< "grub-core/lib/gnulib-patches/$patchname.patch"
done