[2.46 PATCHES] Fix build under glibc 2.43
Sam James
sam@gentoo.org
Thu May 7 10:38:42 GMT 2026
"H.J. Lu" <hjl.tools@gmail.com> writes:
> <features.h> from glibc 2.43 has
>
> /* If _GNU_SOURCE was defined by the user, turn on all the other features. */
> #ifdef _GNU_SOURCE
> # undef _ISOC95_SOURCE
> # define _ISOC95_SOURCE 1
> # undef _ISOC99_SOURCE
> # define _ISOC99_SOURCE 1
> # undef _ISOC11_SOURCE
> # define _ISOC11_SOURCE 1
> # undef _ISOC23_SOURCE
> # define _ISOC23_SOURCE 1
>
> which triggers
>
> /export/gnu/import/git/gitlab/x86-binutils-release/gprof/source.c: In
> function ‘annotate_source’:
> /export/gnu/import/git/gitlab/x86-binutils-release/gprof/source.c:126:21:
> error: assignment discards ‘const’ qualifier from pointer target type
> [-Werror=discarded-qualifiers]
> 126 | name_only = strrchr (sf->name, '/');
> | ^
> cc1: all warnings being treated as errors
>
> since <string.h> has
>
> # if __GLIBC_USE (ISOC23) && defined __glibc_const_generic && !defined _LIBC
> # define strrchr(S, C) \
> __glibc_const_generic (S, const char *, strrchr (S, C))
> # endif
> #endif
>
> Backport the following patches from master branch:
>
> bfbfc5338fe Fix discarded-qualifiers problems in ldlang.c
> f4e1e879c3b ld: Fix calls to strchr that discard or use wrong const qualifiers
> 23cffbed18e binutils: fix C23 -Wdiscarded-qualifiers errors
> 742891031fb Fix the strrchr error for DOS based filesystem
> 2c40bfc752b gprof: Fix strchr discarded qualifier call
>
> to fix the binutils 2.46 build under glibc 2.43.
>
> Any comments?
I think it's a good idea.
Nick, I'd like to make a 2.46.1 release with these patches
because of the -Werror thing with 2.46.0
(https://inbox.sourceware.org/binutils/c4e611d0-2ef2-4495-8623-7ec82df3f101@gmail.com/).
Is that OK with you?
> [...]
sam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 418 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20260507/91878c2c/attachment.sig>
More information about the Binutils
mailing list