Il 25/07/21 19:39, Florian Weimer ha scritto:
* Mattia Verga via devel:
> Hello folks,
>
> I've just noticed that in F35 Mass rebuild everything related to Free
> Pascal is now failing to build.
> The fpc compiler itself is FTB with the following output:
>
> /usr/bin/ld:
>
/builddir/build/BUILD/fpcbuild-3.2.2/fpcsrc/rtl/units/powerpc64-linux/si_c.o:(.data.n_TC_$SI_C_$$_START_ADDRESSES+0x10):
> undefined reference to `__libc_csu_init'
> /usr/bin/ld:
>
/builddir/build/BUILD/fpcbuild-3.2.2/fpcsrc/rtl/units/powerpc64-linux/si_c.o:(.data.n_TC_$SI_C_$$_START_ADDRESSES+0x18):
> undefined reference to `__libc_csu_fini'
> Error: Error while linking
>
> From a quick search on search engines it seems a glibc misconfiguration
> of some sort... ?
> The latest fpc that was built successfully on F35 used glibc
> 2.33.9000-2.fc35
It's related to startup code hardening in glibc. In general, it's not
forward-compatible to call internal glibc functions this way.
__libc_csu_init and __libc_csu_fini where never part of any header file.
It's not clear to me why fpc needs to replace the startup code. They
could supply a C main function and call Pascall code from that. Or
compile the main program in such a way that it has a compatible
interface with the C main program.
To adjust to the glibc 2.34 changes without fixing the underlying
problem, use this:
- .quad __libc_csu_init
- .quad __libc_csu_fini
+ .quad 0
+ .quad 0
Similarly for the other architectures.
You can use this glibc commit for reference purposes:
commit 035c012e32c11e84d64905efaf55e74f704d3668
Author: Florian Weimer <fweimer(a)redhat.com>
Date: Thu Feb 25 12:10:57 2021 +0100
Reduce the statically linked startup code [BZ #23323]
Note that if these changes are applied on older glibc versions (before
2.34), ELF constructors for the main program will no longer run. But
apart from that, I think this will be a compatible change.
Please also add the glibc copyright headers where they are missing.
Thanks,
Florian
Thanks Florian, I'll CC the fpc maintainers to the discussion, since I
really have no knowledge about what we're talking ;-)
Mattia