LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Machhiwal <amachhiw@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Amit Machhiwal <amachhiw@linux.ibm.com>,
	Laurent Vivier <lvivier@redhat.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org
Subject: Re: [PATCH] powerpc: Link with -z notext
Date: Wed, 11 Nov 2026 15:48:07 +0530	[thread overview]
Message-ID: <20261111145459.6b15a2c5-eb-amachhiw@linux.ibm.com> (raw)
In-Reply-To: <1346902a-67ba-49e5-9dfc-fc3990c3329d@redhat.com>

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


  reply	other threads:[~2026-11-11 10:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 15:44 [PATCH] powerpc: Link with -z notext Amit Machhiwal
2026-11-11  7:54 ` Thomas Huth
2026-11-11 10:18   ` Amit Machhiwal [this message]
2026-11-11  8:30 ` Thomas Huth

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=20261111145459.6b15a2c5-eb-amachhiw@linux.ibm.com \
    --to=amachhiw@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lvivier@redhat.com \
    --cc=maddy@linux.ibm.com \
    --cc=thuth@redhat.com \
    /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