Re: A partial workaround for lang/gcc14 building on/for armv7, given STANDARD_BOOTSTRAP hitting some FreeBSD __aeabi_* symbol issues

From: mmel@freebsd.org <mmel_at_FreeBSD.org>
Date: Sun, 27 Apr 2025 16:22:36 UTC
On 27. 4. 2025 17:34, Mark Millard wrote:
>> I don't know the internals of gcc, but the problem is clear and simple. gcc14 does not provide unwinder symbols in the case of '-static-libgcc' and the FBSD configuration in default(implicit) libraries.
>
> Then why does building lang/gcc14 work on each of:
>
> 14.1-Release
> 14.2-Release
> 14.2-Stable
>
> but not on main [so: 15]?
>
> Only main has armv7 lang/gcc14* build failures
> on the official builders. Seems odd if it is just
> lang/gcc1[45]* 's problem.

I don't have any 14 jailready, so I have no idea. Maybe the libc in 
FBSD14 has a different link to unwinder.

But I can confirm, that gcc13 have exactly same problem (only it is 
hidden because gcc13 build doesn't use '-static-libgcc'). Trivial 
reproducer for this issue is 'gcc{13,14...} -static-libgcc main.c' where 
main.c is empty function ('void main(void) {}');

>> I can only assume that there is some problem with the implicit library definition related to the FBSD configuration.
>>
>> IMHO '-static-libgcc' should imply '-lgcc_eh', but again this is just gues. Or the default linker script needs more love.
> The failing context on main has:
>
> File: /wrkdirs/usr/ports/lang/gcc14/work/.build/prev-gcc/libgcc_eh.a(unwind-arm.o)
> 000000f8 00002f1a R_ARM_GOT_BREL      00000c30 __aeabi_unwind_cpp_pr2
> 000000fc 0000301a R_ARM_GOT_BREL      00000c28 __aeabi_unwind_cpp_pr1
>     46: 0000000000000c20     8 FUNC    GLOBAL HIDDEN     1 __aeabi_unwind_cpp_pr0
>     47: 0000000000000c30     8 FUNC    WEAK   HIDDEN     1 __aeabi_unwind_cpp_pr2
>     48: 0000000000000c28     8 FUNC    WEAK   HIDDEN     1 __aeabi_unwind_cpp_pr1

I'm sorry, it was my misinterpretation. For gcc aeabi_unwind_cpp_pr* 
symbols in a shared environment are exported by libgcc_s.so. In a static 
environment (libgcc.a) these symbols are not exported from any library 
(HIDDEN symbols are not visible for references from dynamic shared 
libraries) .

So root cause remains the same. The compiler does not provide 
aeabi_unwind_cpp_pr* if the '-static-libgcc' option is selected.

Michal