[PATCH] Fix libiberty.h inclusion on non-glibc hosts tree-wide
Iain Sandoe
iain@sandoe.co.uk
Wed Nov 18 07:41:24 GMT 2026
@sam, @pietro … any ideas most welcome.
> On 18 Nov 2026, at 12:24, Jan Beulich <jbeulich@suse.com> wrote:
>
> On 18.11.2026 01:49, Nick Alcock wrote:
>> In 2025, Iain Sandoe added memrchr support to libiberty.h. This requires
>> a new AC_CHECK_FUNCS of memrchr in every project that transitively
>> includes it, or builds on non-glibc, non-Linux hosts will fail (observed
>> on FreeBSD 15).
In a way, it’s a nit surprising to find a *BSD having an issue (since it was a
BSD derivative that prompted adding this)…but that’s life :)
>> Fix trivial, but a tad invasive, since a lot of projects include
>> libiberty.h, and it shows up a few places that don't include config.h at
>> all (including some that include ansidecl.h, which requires config.h for
>> proper operation).
>>
>> All relevant configury regenerated.
>>
>> Also touches GDB machinery, so gdb-patches is Cc:ed.
>>
>> Iain Sandoe Cc:ed: Iain, if you disagree with my rather nasty approach
>> here, I'd be interested in anything better. (The need to use %top in
>> binutils/arlex.l is slightly worrying. It's not in POSIX, but
>> we need something like it or we can't include config.h before the
>> system headers it must precede. (Including config.h in libiberty.h
>> won't work for the same reason.)
>
> What does this mean compatibility-wise? I.e. when did relevant tools (no
> idea which one it would be on the BSDs) start supporting %top?
I have no better idea - unless there’s a way to down-scope the addition to
GCC-local.
Adding folks who are currently working on updating GCC’s configury…
Iain
>
> Jan
More information about the Binutils
mailing list