Index | Thread | Search

From:
Theo Buehler <tb@openbsd.org>
Subject:
Re: lang/gcc 11 and 15: fix unwinding and C++ exceptions
To:
ports@openbsd.org, pascal@openbsd.org, claudio@openbsd.org, kirill@openbsd.org
Date:
Mon, 10 Nov 2025 16:25:18 +0100

Download raw body.

Thread
On Mon, Nov 10, 2025 at 03:27:31PM +0100, Jeremie Courreges-Anglas wrote:
> 
> During the previous months our attempts at using gcc/11 or gcc/15 on
> sparc64 had faced a crash in devel/boost.  The crash was the
> "gcc_assert (code == _URC_NO_REASON);" in libgcc's uw_init_context_1()
> meaning the code wasn't able to find frame information.  This was
> reproducible also on amd64 or arm64.
> 
> The culprit was this check added between gcc 8 and 11:
> 
>    #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
> +      && defined(TARGET_DL_ITERATE_PHDR) \
>        && (defined(__OpenBSD__) || defined(__NetBSD__))
>    # define ElfW(type) Elf_##type
>    # define USE_PT_GNU_EH_FRAME
>    #endif
> 
> With this additional check we're not using PT_GNU_EH_FRAME any more.
> TARGET_DL_ITERATE_PHDR in turn wasn't defined because the code in
> gcc/configure is pretty much hardcoded and nobody noticed the function
> was needed on OpenBSD just like on Solaris or FreeBSD etc.  The diff
> below addresses that.
> 
> There is some similar code hardcoding a differently named #define in
> libgcc/crtstuff.c but the code is apparently not built.
> 
> Keeping our less-than-optimal habits, this diff:
> - bumps the revision for all subpackages even though installing just
>   the new gcc-libs subpackage seems enough in my tests.  Better safe
>   than sorry.
> - doesn't add a comment in this already long and undocumented
>   patch-gcc_configure, but I can add a blurb if someone insists.
> 
> Making progress here was a team effort with claudio and tb!

Thanks for figuring out the final bit. It would have taken me ages.
I haven't tested this specific version of the diff, but it makes sense
and reads fine.

ok