* [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG
@ 2025-06-18 1:58 Andrew Hamilton
2025-06-18 1:58 ` [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile Andrew Hamilton
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Andrew Hamilton @ 2025-06-18 1:58 UTC (permalink / raw)
To: grub-devel; +Cc: daniel.kiper, rudi, phcoder, Andrew Hamilton
1. Correct GRUB build with GCC >= 15 due to new GNULIB compile
warning detected by GCC.
Pull in gnulib fix to allow base64.c to compile using GCC 15 or newer.
Pulled from: GNULIB commit 25df6dc4253480a343dde3376ce6fd99c316a532
GCC 15 adds a new compiler warning "-Wunterminated-string-initialization"
that will trigger what is considered a false-positive in base64.c as this
array is not treated as a string but an array of characters so the lack
of NULL string terminator is expected.
GCC team has added ability to flag such instances of arrays that the
compiler may think are strings as "nonstring" arrays to avoid this
warning: _attribute_((nonstring)). Reference this GCC discussion
for more details:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178
Tested that the compile now succeeds using current mainline development
GCC, build still works with GCC 12.2.0, and build still works with CLANG
14.0.6.
Fixes: https://savannah.gnu.org/bugs/?66470
2. Correct GRUB build with CLANG due to a regression in grub-protect.c
util/grub-protect: Correct uninit 'err' Variable
In function protect_tpm2_export_tpm2key, the 'err' variable
is uninitialized in the normal (error free) path, so ensure this
defaults to GRUB_ERR_NONE.
This causes the GRUB build to fail with clang (observed with
clang-14).
Fixes: 5934bf51c (util/grub-protect: Support NV index mode)
Changes since v1:
- Rebased patches against current master
Andrew Hamilton (2):
gnulib: Add patch to allow GRUB w/GCC-15 compile
util/grub-protect: Correct uninit 'err' Variable
bootstrap.conf | 3 ++-
grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch | 11 +++++++++++
util/grub-protect.c | 2 +-
3 files changed, 14 insertions(+), 2 deletions(-)
create mode 100644 grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
--
2.39.5
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile
2025-06-18 1:58 [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Andrew Hamilton
@ 2025-06-18 1:58 ` Andrew Hamilton
2025-06-18 5:06 ` sudhakar
2025-06-18 1:58 ` [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable Andrew Hamilton
2025-06-18 14:19 ` [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Daniel Kiper via Grub-devel
2 siblings, 1 reply; 6+ messages in thread
From: Andrew Hamilton @ 2025-06-18 1:58 UTC (permalink / raw)
To: grub-devel; +Cc: daniel.kiper, rudi, phcoder, Andrew Hamilton
Pull in gnulib fix to allow base64.c to compile using GCC 15 or newer.
Pulled from: GNULIB commit 25df6dc4253480a343dde3376ce6fd99c316a532
GCC 15 adds a new compiler warning "-Wunterminated-string-initialization"
that will trigger what is considered a false-positive in base64.c as this
array is not treated as a string but an array of characters so the lack
of NULL string terminator is expected.
GCC team has added ability to flag such instances of arrays that the
compiler may think are strings as "nonstring" arrays to avoid this
warning: _attribute_((nonstring)).
Fixes: https://savannah.gnu.org/bugs/?66470
Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
---
bootstrap.conf | 3 ++-
grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
diff --git a/bootstrap.conf b/bootstrap.conf
index 7cd375ba9..4655c2128 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -86,7 +86,8 @@ bootstrap_post_import_hook () {
# add new patches here.
for patchname in fix-width \
fix-regcomp-resource-leak \
- fix-regexec-resource-leak; do
+ fix-regexec-resource-leak \
+ gcc-15-compile-fix; do
patch -d grub-core/lib/gnulib -p2 \
< "grub-core/lib/gnulib-patches/$patchname.patch"
done
diff --git a/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch b/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
new file mode 100644
index 000000000..287332ea0
--- /dev/null
+++ b/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
@@ -0,0 +1,11 @@
+--- a/lib/base64.c
++++ b/lib/base64.c
+@@ -61,7 +61,7 @@
+ return ch;
+ }
+
+-static const char b64c[64] =
++static const char b64c[64] _GL_ATTRIBUTE_NONSTRING =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+ /* Base64 encode IN array of size INLEN into OUT array. OUT needs
--
2.39.5
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile
2025-06-18 1:58 ` [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile Andrew Hamilton
@ 2025-06-18 5:06 ` sudhakar
0 siblings, 0 replies; 6+ messages in thread
From: sudhakar @ 2025-06-18 5:06 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: daniel.kiper, rudi, phcoder, Andrew Hamilton
On 2025-06-18 07:28, Andrew Hamilton wrote:
> Pull in gnulib fix to allow base64.c to compile using GCC 15 or newer.
>
> Pulled from: GNULIB commit 25df6dc4253480a343dde3376ce6fd99c316a532
>
> GCC 15 adds a new compiler warning
> "-Wunterminated-string-initialization"
> that will trigger what is considered a false-positive in base64.c as
> this
> array is not treated as a string but an array of characters so the lack
> of NULL string terminator is expected.
>
> GCC team has added ability to flag such instances of arrays that the
> compiler may think are strings as "nonstring" arrays to avoid this
> warning: _attribute_((nonstring)).
>
> Fixes: https://savannah.gnu.org/bugs/?66470
>
> Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
> ---
> bootstrap.conf | 3 ++-
> grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch | 11 +++++++++++
> 2 files changed, 13 insertions(+), 1 deletion(-)
> create mode 100644
> grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
>
> diff --git a/bootstrap.conf b/bootstrap.conf
> index 7cd375ba9..4655c2128 100644
> --- a/bootstrap.conf
> +++ b/bootstrap.conf
> @@ -86,7 +86,8 @@ bootstrap_post_import_hook () {
> # add new patches here.
> for patchname in fix-width \
> fix-regcomp-resource-leak \
> - fix-regexec-resource-leak; do
> + fix-regexec-resource-leak \
> + gcc-15-compile-fix; do
> patch -d grub-core/lib/gnulib -p2 \
> < "grub-core/lib/gnulib-patches/$patchname.patch"
> done
> diff --git a/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
> b/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
> new file mode 100644
> index 000000000..287332ea0
> --- /dev/null
> +++ b/grub-core/lib/gnulib-patches/gcc-15-compile-fix.patch
> @@ -0,0 +1,11 @@
> +--- a/lib/base64.c
> ++++ b/lib/base64.c
> +@@ -61,7 +61,7 @@
> + return ch;
> + }
> +
> +-static const char b64c[64] =
> ++static const char b64c[64] _GL_ATTRIBUTE_NONSTRING =
> + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
> +
> + /* Base64 encode IN array of size INLEN into OUT array. OUT needs
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable
2025-06-18 1:58 [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Andrew Hamilton
2025-06-18 1:58 ` [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile Andrew Hamilton
@ 2025-06-18 1:58 ` Andrew Hamilton
2025-06-18 4:40 ` sudhakar
2025-06-18 14:19 ` [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Daniel Kiper via Grub-devel
2 siblings, 1 reply; 6+ messages in thread
From: Andrew Hamilton @ 2025-06-18 1:58 UTC (permalink / raw)
To: grub-devel; +Cc: daniel.kiper, rudi, phcoder, Andrew Hamilton
In function protect_tpm2_export_tpm2key, the 'err' variable
is uninitialized in the normal (error free) path, so ensure this
defaults to GRUB_ERR_NONE.
This causes the GRUB build to fail with clang (observed with
clang-14).
Fixes: 5934bf51c (util/grub-protect: Support NV index mode)
Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
---
util/grub-protect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/grub-protect.c b/util/grub-protect.c
index d53c2572d..868eb76b9 100644
--- a/util/grub-protect.c
+++ b/util/grub-protect.c
@@ -703,7 +703,7 @@ protect_tpm2_export_tpm2key (const protect_args_t *args, tpm2_sealed_key_t *seal
struct grub_tpm2_buffer priv_buf;
int i;
int ret;
- grub_err_t err;
+ grub_err_t err = GRUB_ERR_NONE;
if (der_buf == NULL)
return GRUB_ERR_BAD_ARGUMENT;
--
2.39.5
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable
2025-06-18 1:58 ` [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable Andrew Hamilton
@ 2025-06-18 4:40 ` sudhakar
0 siblings, 0 replies; 6+ messages in thread
From: sudhakar @ 2025-06-18 4:40 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: daniel.kiper, rudi, phcoder, Andrew Hamilton
On 2025-06-18 07:28, Andrew Hamilton wrote:
> In function protect_tpm2_export_tpm2key, the 'err' variable
> is uninitialized in the normal (error free) path, so ensure this
> defaults to GRUB_ERR_NONE.
>
> This causes the GRUB build to fail with clang (observed with
> clang-14).
>
> Fixes: 5934bf51c (util/grub-protect: Support NV index mode)
>
> Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
> ---
> util/grub-protect.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/util/grub-protect.c b/util/grub-protect.c
> index d53c2572d..868eb76b9 100644
> --- a/util/grub-protect.c
> +++ b/util/grub-protect.c
> @@ -703,7 +703,7 @@ protect_tpm2_export_tpm2key (const protect_args_t
> *args, tpm2_sealed_key_t *seal
> struct grub_tpm2_buffer priv_buf;
> int i;
> int ret;
> - grub_err_t err;
> + grub_err_t err = GRUB_ERR_NONE;
>
> if (der_buf == NULL)
> return GRUB_ERR_BAD_ARGUMENT;
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG
2025-06-18 1:58 [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Andrew Hamilton
2025-06-18 1:58 ` [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile Andrew Hamilton
2025-06-18 1:58 ` [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable Andrew Hamilton
@ 2025-06-18 14:19 ` Daniel Kiper via Grub-devel
2 siblings, 0 replies; 6+ messages in thread
From: Daniel Kiper via Grub-devel @ 2025-06-18 14:19 UTC (permalink / raw)
To: Andrew Hamilton; +Cc: Daniel Kiper, grub-devel, rudi, phcoder
On Tue, Jun 17, 2025 at 08:58:24PM -0500, Andrew Hamilton wrote:
> 1. Correct GRUB build with GCC >= 15 due to new GNULIB compile
> warning detected by GCC.
>
> Pull in gnulib fix to allow base64.c to compile using GCC 15 or newer.
>
> Pulled from: GNULIB commit 25df6dc4253480a343dde3376ce6fd99c316a532
>
> GCC 15 adds a new compiler warning "-Wunterminated-string-initialization"
> that will trigger what is considered a false-positive in base64.c as this
> array is not treated as a string but an array of characters so the lack
> of NULL string terminator is expected.
>
> GCC team has added ability to flag such instances of arrays that the
> compiler may think are strings as "nonstring" arrays to avoid this
> warning: _attribute_((nonstring)). Reference this GCC discussion
> for more details:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178
>
> Tested that the compile now succeeds using current mainline development
> GCC, build still works with GCC 12.2.0, and build still works with CLANG
> 14.0.6.
>
> Fixes: https://savannah.gnu.org/bugs/?66470
>
> 2. Correct GRUB build with CLANG due to a regression in grub-protect.c
>
> util/grub-protect: Correct uninit 'err' Variable
>
> In function protect_tpm2_export_tpm2key, the 'err' variable
> is uninitialized in the normal (error free) path, so ensure this
> defaults to GRUB_ERR_NONE.
>
> This causes the GRUB build to fail with clang (observed with
> clang-14).
>
> Fixes: 5934bf51c (util/grub-protect: Support NV index mode)
>
> Changes since v1:
> - Rebased patches against current master
>
> Andrew Hamilton (2):
> gnulib: Add patch to allow GRUB w/GCC-15 compile
> util/grub-protect: Correct uninit 'err' Variable
For both patches Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>...
Daniel
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-18 14:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-18 1:58 [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Andrew Hamilton
2025-06-18 1:58 ` [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile Andrew Hamilton
2025-06-18 5:06 ` sudhakar
2025-06-18 1:58 ` [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable Andrew Hamilton
2025-06-18 4:40 ` sudhakar
2025-06-18 14:19 ` [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Daniel Kiper via Grub-devel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.