From: Tom Tromey <tom@tromey.com>
To: Nick Alcock <nix@esperi.org.uk>
Cc: binutils@sourceware.org, gdb-patches@sourceware.org, iain@sandoe.co.uk
Subject: Re: [PATCH] Fix libiberty.h inclusion on non-glibc hosts tree-wide
Date: Thu, 19 Nov 2026 13:35:39 -0700 [thread overview]
Message-ID: <87bj7kzhic.fsf@tromey.com> (raw)
In-Reply-To: <20261118004926.6404-1-nix@esperi.org.uk> (Nick Alcock's message of "Wed, 18 Nov 2026 00:49:26 +0000")
>>>>> "Nick" == Nick Alcock <nix@esperi.org.uk> writes:
Nick> In 2025, Iain Sandoe added memrchr support to libiberty.h. This requires
Nick> a new AC_CHECK_FUNCS of memrchr in every project that transitively
Nick> includes it, or builds on non-glibc, non-Linux hosts will fail (observed
Nick> on FreeBSD 15).
Not really your issue but this would all be a lot simpler if libiberty
made a config.h-style header with its own namespaced names, and then
included this and checked these names from the include/ headers.
That way changes to libiberty wouldn't have to propagate through all the
possible users.
gdb kinds of works around this deficiency with libiberty.m4 but really
that's a failure of encapsulation.
Nick> Iain Sandoe Cc:ed: Iain, if you disagree with my rather nasty approach
Nick> here, I'd be interested in anything better. (The need to use %top in
Nick> binutils/arlex.l is slightly worrying. It's not in POSIX, but
Nick> we need something like it or we can't include config.h before the
Nick> system headers it must precede. (Including config.h in libiberty.h
Nick> won't work for the same reason.)
In gdb we switched to pre-including the "defs.h" file from the compiler
command line, which I guess avoids stuff like this. Though at the same
time I don't think we had this precise problem so I wonder what's up
with that.
The gdb and sim bits here are fine but it sounds like this patch is
going to be handled a different way in libiberty?
thanks,
Tom
next prev parent reply other threads:[~2026-11-19 20:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 0:49 Nick Alcock
2026-11-18 7:24 ` Jan Beulich
2026-11-18 7:41 ` Iain Sandoe
2026-11-18 11:50 ` Nick Alcock
2026-11-18 8:39 ` Sam James
2026-11-18 12:00 ` Nick Alcock
2026-11-18 12:12 ` Sam James
2026-11-18 17:18 ` Nix
2026-11-19 20:35 ` Tom Tromey [this message]
2026-11-20 15:25 ` [PATCH v2] Support libiberty functions as macros; fix up AC_CHECK_DECL tree-wide Nick Alcock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bj7kzhic.fsf@tromey.com \
--to=tom@tromey.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=iain@sandoe.co.uk \
--cc=nix@esperi.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox