* [PATCH v2 0/4] Fix const qualifier build errors with recent glibc
@ 2025-12-15 10:19 Cédric Le Goater
2025-12-15 10:19 ` [PATCH v2 1/4] i386: " Cédric Le Goater
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Cédric Le Goater @ 2025-12-15 10:19 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini,
Richard Henderson, Alex Bennée, Cédric Le Goater
Hello,
More fixes for the build breakage due to the recent change in glibc
2.42.9000 :
https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
Thanks,
C.
Changes in v2:
- I did a full QEMU build this time and found a couple more issues to
fix. We should be done now.
Cédric Le Goater (4):
i386: Fix const qualifier build errors with recent glibc
tests/vhost-user-bridge.c: Fix const qualifier build errors with
recent glibc
monitor: Fix const qualifier build errors with recent glibc
gdbstub: Fix const qualifier build errors with recent glibc
gdbstub/user.c | 2 +-
hw/i386/x86-common.c | 2 +-
monitor/hmp.c | 5 +++--
tests/vhost-user-bridge.c | 10 ++++------
4 files changed, 9 insertions(+), 10 deletions(-)
--
2.52.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/4] i386: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 [PATCH v2 0/4] Fix const qualifier build errors with recent glibc Cédric Le Goater
@ 2025-12-15 10:19 ` Cédric Le Goater
2025-12-15 10:19 ` [PATCH v2 2/4] tests/vhost-user-bridge.c: " Cédric Le Goater
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Cédric Le Goater @ 2025-12-15 10:19 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini,
Richard Henderson, Alex Bennée, Cédric Le Goater
A recent change in glibc 2.42.9000 [1] changes the return type of
strstr() and other string functions to be 'const char *' when the
input is a 'const char *'. This breaks the build in :
../hw/i386/x86-common.c:827:11: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
827 | vmode = strstr(kernel_cmdline, "vga=");
| ^
Fix this by changing the type of the variables that store the result
of these functions to 'const char *'.
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20251210181306.926334-2-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/i386/x86-common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index c844749900a30c9c9c284c529e93c84c9457b128..f77e2e63046ff56d079363e411a9ee0eca365291 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -654,7 +654,7 @@ void x86_load_linux(X86MachineState *x86ms,
uint8_t header[8192], *setup, *kernel;
hwaddr real_addr, prot_addr, cmdline_addr, initrd_addr = 0;
FILE *f;
- char *vmode;
+ const char *vmode;
MachineState *machine = MACHINE(x86ms);
struct setup_data *setup_data;
const char *kernel_filename = machine->kernel_filename;
--
2.52.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/4] tests/vhost-user-bridge.c: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 [PATCH v2 0/4] Fix const qualifier build errors with recent glibc Cédric Le Goater
2025-12-15 10:19 ` [PATCH v2 1/4] i386: " Cédric Le Goater
@ 2025-12-15 10:19 ` Cédric Le Goater
2025-12-16 11:01 ` Thomas Huth
2025-12-15 10:19 ` [PATCH v2 3/4] monitor: " Cédric Le Goater
2025-12-15 10:19 ` [PATCH v2 4/4] gdbstub: " Cédric Le Goater
3 siblings, 1 reply; 10+ messages in thread
From: Cédric Le Goater @ 2025-12-15 10:19 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini,
Richard Henderson, Alex Bennée, Cédric Le Goater,
Yodel Eldar
A recent change in glibc 2.42.9000 [1] changes the return type of
strstr() and other string functions to be 'const char *' when the
input is a 'const char *'. This breaks the build in :
../tests/vhost-user-bridge.c: In function ‘vubr_parse_host_port’:
../tests/vhost-user-bridge.c:749:15: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
749 | char *p = strchr(buf, ':');
| ^~~~~~
Fix this by using the glib g_strsplit() routine instead of strdup().
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Yodel Eldar <yodel.eldar@yodel.dev>
Tested-by: Yodel Eldar <yodel.eldar@yodel.dev>
Link: https://lore.kernel.org/qemu-devel/20251210181306.926334-3-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
tests/vhost-user-bridge.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c
index a5c711b1de8e9c164dd1614f4329b8e3c05d0402..ce4c3426d3938a0b54195f3e95bb1f1c3c4ae823 100644
--- a/tests/vhost-user-bridge.c
+++ b/tests/vhost-user-bridge.c
@@ -746,14 +746,12 @@ vubr_run(VubrDev *dev)
static int
vubr_parse_host_port(const char **host, const char **port, const char *buf)
{
- char *p = strchr(buf, ':');
-
- if (!p) {
+ g_auto(GStrv) tokens = g_strsplit(buf, ":", 2);
+ if (!tokens[0] || !tokens[1]) {
return -1;
}
- *p = '\0';
- *host = strdup(buf);
- *port = strdup(p + 1);
+ *host = g_steal_pointer(&tokens[0]);
+ *port = g_steal_pointer(&tokens[1]);
return 0;
}
--
2.52.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/4] monitor: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 [PATCH v2 0/4] Fix const qualifier build errors with recent glibc Cédric Le Goater
2025-12-15 10:19 ` [PATCH v2 1/4] i386: " Cédric Le Goater
2025-12-15 10:19 ` [PATCH v2 2/4] tests/vhost-user-bridge.c: " Cédric Le Goater
@ 2025-12-15 10:19 ` Cédric Le Goater
2025-12-15 11:07 ` Philippe Mathieu-Daudé
2025-12-16 11:02 ` Thomas Huth
2025-12-15 10:19 ` [PATCH v2 4/4] gdbstub: " Cédric Le Goater
3 siblings, 2 replies; 10+ messages in thread
From: Cédric Le Goater @ 2025-12-15 10:19 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini,
Richard Henderson, Alex Bennée, Cédric Le Goater
A recent change in glibc 2.42.9000 [1] changes the return type of
strchr() and other string functions to be 'const char *' when the
input is a 'const char *'. This breaks the build in :
../monitor/hmp.c:589:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
589 | p = strchr(type, ':');
| ^
Fix this by changing the type of the variables that store the result
of these functions to 'const char *'.
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
monitor/hmp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/monitor/hmp.c b/monitor/hmp.c
index 34e2b8f748b425e1e4446e8e64aa25b1433d1162..a3ee02e52cda530508b170c4c5e8357b304f7df6 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -577,10 +577,11 @@ static const char *get_command_name(const char *cmdline,
* Read key of 'type' into 'key' and return the current
* 'type' pointer.
*/
-static char *key_get_info(const char *type, char **key)
+static const char *key_get_info(const char *type, char **key)
{
size_t len;
- char *p, *str;
+ const char *p;
+ char *str;
if (*type == ',') {
type++;
--
2.52.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/4] gdbstub: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 [PATCH v2 0/4] Fix const qualifier build errors with recent glibc Cédric Le Goater
` (2 preceding siblings ...)
2025-12-15 10:19 ` [PATCH v2 3/4] monitor: " Cédric Le Goater
@ 2025-12-15 10:19 ` Cédric Le Goater
2025-12-15 11:08 ` Philippe Mathieu-Daudé
2025-12-16 11:03 ` Thomas Huth
3 siblings, 2 replies; 10+ messages in thread
From: Cédric Le Goater @ 2025-12-15 10:19 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini,
Richard Henderson, Alex Bennée, Cédric Le Goater
A recent change in glibc 2.42.9000 [1] changes the return type of
strstr() and other string functions to be 'const char *' when the
input is a 'const char *'. This breaks the build in :
../gdbstub/user.c:322:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
322 | pid_placeholder = strstr(path, "%d");
| ^
Fix this by changing the type of the variables that store the result
of these functions to 'const char *'.
[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
gdbstub/user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdbstub/user.c b/gdbstub/user.c
index 2e14ded3f01053d4d4a36426c509ce7a6b81cb67..e233c598165ca1b10a5f2a89c87136df9af636ca 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -317,7 +317,7 @@ static bool gdb_accept_socket(int gdb_fd)
static int gdbserver_open_socket(const char *path, Error **errp)
{
g_autoptr(GString) buf = g_string_new("");
- char *pid_placeholder;
+ const char *pid_placeholder;
pid_placeholder = strstr(path, "%d");
if (pid_placeholder != NULL) {
--
2.52.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/4] monitor: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 ` [PATCH v2 3/4] monitor: " Cédric Le Goater
@ 2025-12-15 11:07 ` Philippe Mathieu-Daudé
2025-12-16 11:02 ` Thomas Huth
1 sibling, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-12-15 11:07 UTC (permalink / raw)
To: Cédric Le Goater, qemu-devel
Cc: Peter Maydell, Paolo Bonzini, Richard Henderson, Alex Bennée
On 15/12/25 11:19, Cédric Le Goater wrote:
> A recent change in glibc 2.42.9000 [1] changes the return type of
> strchr() and other string functions to be 'const char *' when the
> input is a 'const char *'. This breaks the build in :
>
> ../monitor/hmp.c:589:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> 589 | p = strchr(type, ':');
> | ^
>
> Fix this by changing the type of the variables that store the result
> of these functions to 'const char *'.
>
> [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> monitor/hmp.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] gdbstub: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 ` [PATCH v2 4/4] gdbstub: " Cédric Le Goater
@ 2025-12-15 11:08 ` Philippe Mathieu-Daudé
2025-12-16 11:03 ` Thomas Huth
1 sibling, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-12-15 11:08 UTC (permalink / raw)
To: Cédric Le Goater, qemu-devel
Cc: Peter Maydell, Paolo Bonzini, Richard Henderson, Alex Bennée
On 15/12/25 11:19, Cédric Le Goater wrote:
> A recent change in glibc 2.42.9000 [1] changes the return type of
> strstr() and other string functions to be 'const char *' when the
> input is a 'const char *'. This breaks the build in :
>
> ../gdbstub/user.c:322:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> 322 | pid_placeholder = strstr(path, "%d");
> | ^
> Fix this by changing the type of the variables that store the result
> of these functions to 'const char *'.
>
> [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> gdbstub/user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/4] tests/vhost-user-bridge.c: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 ` [PATCH v2 2/4] tests/vhost-user-bridge.c: " Cédric Le Goater
@ 2025-12-16 11:01 ` Thomas Huth
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Huth @ 2025-12-16 11:01 UTC (permalink / raw)
To: Cédric Le Goater, qemu-devel
Cc: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini,
Richard Henderson, Alex Bennée, Yodel Eldar
On 15/12/2025 11.19, Cédric Le Goater wrote:
> A recent change in glibc 2.42.9000 [1] changes the return type of
> strstr() and other string functions to be 'const char *' when the
> input is a 'const char *'. This breaks the build in :
>
> ../tests/vhost-user-bridge.c: In function ‘vubr_parse_host_port’:
> ../tests/vhost-user-bridge.c:749:15: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> 749 | char *p = strchr(buf, ':');
> | ^~~~~~
>
> Fix this by using the glib g_strsplit() routine instead of strdup().
>
> [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Acked-by: Yodel Eldar <yodel.eldar@yodel.dev>
> Tested-by: Yodel Eldar <yodel.eldar@yodel.dev>
> Link: https://lore.kernel.org/qemu-devel/20251210181306.926334-3-clg@redhat.com
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> tests/vhost-user-bridge.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c
> index a5c711b1de8e9c164dd1614f4329b8e3c05d0402..ce4c3426d3938a0b54195f3e95bb1f1c3c4ae823 100644
> --- a/tests/vhost-user-bridge.c
> +++ b/tests/vhost-user-bridge.c
> @@ -746,14 +746,12 @@ vubr_run(VubrDev *dev)
> static int
> vubr_parse_host_port(const char **host, const char **port, const char *buf)
> {
> - char *p = strchr(buf, ':');
> -
> - if (!p) {
> + g_auto(GStrv) tokens = g_strsplit(buf, ":", 2);
> + if (!tokens[0] || !tokens[1]) {
> return -1;
> }
> - *p = '\0';
> - *host = strdup(buf);
> - *port = strdup(p + 1);
> + *host = g_steal_pointer(&tokens[0]);
> + *port = g_steal_pointer(&tokens[1]);
> return 0;
> }
>
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 3/4] monitor: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 ` [PATCH v2 3/4] monitor: " Cédric Le Goater
2025-12-15 11:07 ` Philippe Mathieu-Daudé
@ 2025-12-16 11:02 ` Thomas Huth
1 sibling, 0 replies; 10+ messages in thread
From: Thomas Huth @ 2025-12-16 11:02 UTC (permalink / raw)
To: Cédric Le Goater, qemu-devel
Cc: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini,
Richard Henderson, Alex Bennée
On 15/12/2025 11.19, Cédric Le Goater wrote:
> A recent change in glibc 2.42.9000 [1] changes the return type of
> strchr() and other string functions to be 'const char *' when the
> input is a 'const char *'. This breaks the build in :
>
> ../monitor/hmp.c:589:7: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> 589 | p = strchr(type, ':');
> | ^
>
> Fix this by changing the type of the variables that store the result
> of these functions to 'const char *'.
>
> [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> monitor/hmp.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/monitor/hmp.c b/monitor/hmp.c
> index 34e2b8f748b425e1e4446e8e64aa25b1433d1162..a3ee02e52cda530508b170c4c5e8357b304f7df6 100644
> --- a/monitor/hmp.c
> +++ b/monitor/hmp.c
> @@ -577,10 +577,11 @@ static const char *get_command_name(const char *cmdline,
> * Read key of 'type' into 'key' and return the current
> * 'type' pointer.
> */
> -static char *key_get_info(const char *type, char **key)
> +static const char *key_get_info(const char *type, char **key)
> {
> size_t len;
> - char *p, *str;
> + const char *p;
> + char *str;
>
> if (*type == ',') {
> type++;
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 4/4] gdbstub: Fix const qualifier build errors with recent glibc
2025-12-15 10:19 ` [PATCH v2 4/4] gdbstub: " Cédric Le Goater
2025-12-15 11:08 ` Philippe Mathieu-Daudé
@ 2025-12-16 11:03 ` Thomas Huth
1 sibling, 0 replies; 10+ messages in thread
From: Thomas Huth @ 2025-12-16 11:03 UTC (permalink / raw)
To: Cédric Le Goater, qemu-devel
Cc: Philippe Mathieu-Daudé, Peter Maydell, Paolo Bonzini,
Richard Henderson, Alex Bennée
On 15/12/2025 11.19, Cédric Le Goater wrote:
> A recent change in glibc 2.42.9000 [1] changes the return type of
> strstr() and other string functions to be 'const char *' when the
> input is a 'const char *'. This breaks the build in :
>
> ../gdbstub/user.c:322:21: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
> 322 | pid_placeholder = strstr(path, "%d");
> | ^
> Fix this by changing the type of the variables that store the result
> of these functions to 'const char *'.
>
> [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> gdbstub/user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdbstub/user.c b/gdbstub/user.c
> index 2e14ded3f01053d4d4a36426c509ce7a6b81cb67..e233c598165ca1b10a5f2a89c87136df9af636ca 100644
> --- a/gdbstub/user.c
> +++ b/gdbstub/user.c
> @@ -317,7 +317,7 @@ static bool gdb_accept_socket(int gdb_fd)
> static int gdbserver_open_socket(const char *path, Error **errp)
> {
> g_autoptr(GString) buf = g_string_new("");
> - char *pid_placeholder;
> + const char *pid_placeholder;
>
> pid_placeholder = strstr(path, "%d");
> if (pid_placeholder != NULL) {
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-12-16 11:04 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15 10:19 [PATCH v2 0/4] Fix const qualifier build errors with recent glibc Cédric Le Goater
2025-12-15 10:19 ` [PATCH v2 1/4] i386: " Cédric Le Goater
2025-12-15 10:19 ` [PATCH v2 2/4] tests/vhost-user-bridge.c: " Cédric Le Goater
2025-12-16 11:01 ` Thomas Huth
2025-12-15 10:19 ` [PATCH v2 3/4] monitor: " Cédric Le Goater
2025-12-15 11:07 ` Philippe Mathieu-Daudé
2025-12-16 11:02 ` Thomas Huth
2025-12-15 10:19 ` [PATCH v2 4/4] gdbstub: " Cédric Le Goater
2025-12-15 11:08 ` Philippe Mathieu-Daudé
2025-12-16 11:03 ` Thomas Huth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).