Hi Thomas,
On 2026/11/11 08:54 AM, Thomas Huth wrote:
> Am 10.11.26 um 16:44 schrieb Amit Machhiwal:
> > Building the powerpc tests with GNU ld 2.46.1 fails when linking the
> > test binaries:
> >
> > /usr/bin/ld.bfd: error: read-only segment has dynamic relocations
> Hi!
>
> This does not happen for me (using GNU ld version 2.46.1-1.fc44 from Fedora
> 44) ... which compiler and distro are you using?
Thanks for checking!
I'm also using the same GNU ld version on Fedora 44 PPC64LE host (more details
are below). Are you cross compiling on an x86 host by any chance where you are
not seeing this problem?
Assuming that you are, the difference is due to the default linker configuration
between native and cross-compilation packages on Fedora:
On native Fedora 44 ppc64le:
----------------------------
$ ld --help | grep -E '\-z (no)?text'
-z text Treat DT_TEXTREL in output as error (default)
-z notext Don't treat DT_TEXTREL in output as error
-z textoff Don't treat DT_TEXTREL in output as error
On Fedora x86_64 cross-linker (powerpc64le-linux-gnu-ld):
---------------------------------------------------------
$ powerpc64le-linux-gnu-ld --help | grep -E '\-z (no)?text'
-z text Treat DT_TEXTREL in output as error
-z notext Don't treat DT_TEXTREL in output as error
(default)
-z textoff Don't treat DT_TEXTREL in output as error
(default)
Because the cross-linker defaults to `-z notext`, cross-compiling on x86_64
succeeds silently, whereas native builds fail:
/usr/bin/ld.bfd: error: read-only segment has dynamic relocations
Toolchain & host details (ppc64le native):
------------------------------------------
$ uname -a
Linux fedora 7.3.3-200.fc44.ppc64le #1 SMP PREEMPT_DYNAMIC Fri Nov 6 20:22:11
UTC 2026 ppc64le GNU/Linux
$ ld --version
GNU ld version 2.46.1-1.fc44
Thanks,
Amit