Merge pull request 'coreboot: fam15h: Add patches to fix build with GCC 15 as host compiler' (#318) from alpernebbi/lbmk:coreboot-fam15h-gcc15 into master

Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/318
This commit is contained in:
Leah Rowe
2025-04-29 17:13:45 +00:00
2 changed files with 158 additions and 0 deletions
@@ -0,0 +1,39 @@
From 281151d85240bd8a60545b6415e0f44ce6a2af33 Mon Sep 17 00:00:00 2001
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Tue, 29 Apr 2025 17:31:13 +0300
Subject: [PATCH] WIP: Fix build with GCC 15 as host compiler
GCC 15 now considers the unterminated-string-initialization warning as
part of -Werror by default. Coreboot compiles host utilities with the
system compiler, which results in getting this error in some files.
Mark a hexadecimal translation table in cbfstool code as "nonstring" to
avoid the warning-turned-error.
The bios log prefixes are non-null-terminated as well, but I couldn't
figure out how to mark them as non-strings. Temporarily disable the
warning with a pragma to avoid the error. That pragma causes an error on
GCC 14, so disable pragma warnings along with it to avoid that as well.
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---
util/cbfstool/common.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index 7154bc9d5425..cb08c9e8ec11 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -192,7 +192,7 @@ uint64_t intfiletype(const char *name)
char *bintohex(uint8_t *data, size_t len)
{
- static const char translate[16] = "0123456789abcdef";
+ static const char translate[16] __attribute__((__nonstring__)) = "0123456789abcdef";
char *result = malloc(len * 2 + 1);
if (result == NULL)
--
2.49.0
@@ -0,0 +1,119 @@
From 74dc3c0a4603bc635c8bc5e95490cdf168af5f41 Mon Sep 17 00:00:00 2001
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Tue, 29 Apr 2025 19:46:14 +0300
Subject: [PATCH] util/romcc: Fix build with GCC 15
With GCC 15, we get build errors complaining bool is a reserved keyword,
so cannot be used as a function name. Rename our bool() to bool_().
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---
util/romcc/romcc.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/util/romcc/romcc.c b/util/romcc/romcc.c
index 378bfc50f290..b375e0fc83cb 100644
--- a/util/romcc/romcc.c
+++ b/util/romcc/romcc.c
@@ -7137,7 +7137,7 @@ static void integral(struct compile_state *state, struct triple *def)
}
-static void bool(struct compile_state *state, struct triple *def)
+static void bool_(struct compile_state *state, struct triple *def)
{
if (!TYPE_ARITHMETIC(def->type->type) &&
((def->type->type & TYPE_MASK) != TYPE_POINTER)) {
@@ -7705,7 +7705,7 @@ static struct triple *mkcond_expr(
struct triple *def, *val, *var, *jmp1, *jmp2, *top, *mid, *end;
struct type *result_type;
unsigned int left_type, right_type;
- bool(state, test);
+ bool_(state, test);
left_type = left->type->type;
right_type = right->type->type;
result_type = 0;
@@ -11036,7 +11036,7 @@ static struct triple *unary_expr(struct compile_state *state)
case TOK_BANG:
eat(state, TOK_BANG);
right = read_expr(state, cast_expr(state));
- bool(state, right);
+ bool_(state, right);
def = lfalse_expr(state, right);
break;
case TOK_SIZEOF:
@@ -11363,10 +11363,10 @@ static struct triple *land_expr(struct compile_state *state)
while(peek(state) == TOK_LOGAND) {
struct triple *left, *right;
left = read_expr(state, def);
- bool(state, left);
+ bool_(state, left);
eat(state, TOK_LOGAND);
right = read_expr(state, or_expr(state));
- bool(state, right);
+ bool_(state, right);
def = mkland_expr(state,
ltrue_expr(state, left),
@@ -11382,10 +11382,10 @@ static struct triple *lor_expr(struct compile_state *state)
while(peek(state) == TOK_LOGOR) {
struct triple *left, *right;
left = read_expr(state, def);
- bool(state, left);
+ bool_(state, left);
eat(state, TOK_LOGOR);
right = read_expr(state, land_expr(state));
- bool(state, right);
+ bool_(state, right);
def = mklor_expr(state,
ltrue_expr(state, left),
@@ -11400,7 +11400,7 @@ static struct triple *conditional_expr(struct compile_state *state)
def = lor_expr(state);
if (peek(state) == TOK_QUEST) {
struct triple *test, *left, *right;
- bool(state, def);
+ bool_(state, def);
test = ltrue_expr(state, read_expr(state, def));
eat(state, TOK_QUEST);
left = read_expr(state, expr(state));
@@ -11676,7 +11676,7 @@ static void if_statement(struct compile_state *state, struct triple *first)
eat(state, TOK_IF);
eat(state, TOK_LPAREN);
test = expr(state);
- bool(state, test);
+ bool_(state, test);
/* Cleanup and invert the test */
test = lfalse_expr(state, read_expr(state, test));
eat(state, TOK_RPAREN);
@@ -11719,7 +11719,7 @@ static void for_statement(struct compile_state *state, struct triple *first)
eat(state, TOK_SEMI);
if (peek(state) != TOK_SEMI) {
test = expr(state);
- bool(state, test);
+ bool_(state, test);
test = ltrue_expr(state, read_expr(state, test));
}
eat(state, TOK_SEMI);
@@ -11767,7 +11767,7 @@ static void while_statement(struct compile_state *state, struct triple *first)
eat(state, TOK_WHILE);
eat(state, TOK_LPAREN);
test = expr(state);
- bool(state, test);
+ bool_(state, test);
test = ltrue_expr(state, read_expr(state, test));
eat(state, TOK_RPAREN);
/* Generate the needed pieces */
@@ -11818,7 +11818,7 @@ static void do_statement(struct compile_state *state, struct triple *first)
eat(state, TOK_WHILE);
eat(state, TOK_LPAREN);
test = read_expr(state, expr(state));
- bool(state, test);
+ bool_(state, test);
eat(state, TOK_RPAREN);
eat(state, TOK_SEMI);
/* Thread the pieces together */
--
2.49.0