LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Anushree Mathur <anushree.mathur@linux.ibm.com>
To: Amit Machhiwal <amachhiw@linux.ibm.com>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	Antonio Alvarez Feijoo <antonio.feijoo@suse.com>,
	Vaibhav Jain <vaibhav@linux.ibm.com>,
	Harsh Prateek Bora <harshpb@linux.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/boot: Allow text relocations for pseries wrapper with binutils 2.46+
Date: Tue, 26 May 2026 12:14:23 +0530	[thread overview]
Message-ID: <6169bbc4-1829-4b9e-bb2c-a508a001e1b6@linux.ibm.com> (raw)
In-Reply-To: <20260525161601.32097-1-amachhiw@linux.ibm.com>



On 25/05/26 9:46 PM, Amit Machhiwal wrote:
> Binutils 2.46 changed the default linker behavior from '-z notext' to
> '-z text', which treats dynamic relocations in read-only segments as
> errors rather than warnings. This causes the pseries boot wrapper build
> to fail with:
>
>    /usr/bin/ld.bfd: arch/powerpc/boot/wrapper.a(crt0.o): warning:
>      relocation against `_platform_stack_top' in read-only section `.text'
>    /usr/bin/ld.bfd: error: read-only segment has dynamic relocations
>
> The pseries wrapper uses '-pie' to create position-independent code.
> However, crt0.S contains a pointer to '_platform_stack_top' in the .text
> section, which requires a dynamic relocation at runtime. This creates
> DT_TEXTREL (text relocations), which were allowed by default in binutils
> 2.45 and earlier (via implicit '-z notext') but are now rejected by
> binutils 2.46+.
>
> Add '-z notext' linker flag to explicitly allow text relocations for
> the pseries platform, similar to what is already done for the epapr
> platform. This restores the previous behavior and allows the boot
> wrapper to build successfully with binutils 2.46+.
>
> Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
> ---
>   arch/powerpc/boot/wrapper | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
> index 1efd1206fcab..25321ce262e8 100755
> --- a/arch/powerpc/boot/wrapper
> +++ b/arch/powerpc/boot/wrapper
> @@ -262,6 +262,7 @@ pseries)
>       if [ "$format" != "elf32ppc" ]; then
>   	link_address=
>   	pie=-pie
> +	notext='-z notext'
>       fi
>       make_space=n
>       ;;
>
> base-commit: e7ae89a0c97ce2b68b0983cd01eda67cf373517d
Hi Amit,
I have tested this patch and it has fixed the kernel build issue. Here 
is my analysis:

i) Without applying the patch:

Kernel build failed with below error -

   CC [M]  drivers/net/usb/r8152.mod.o
   CC [M]  drivers/net/usb/hso.mod.o
   CC [M]  drivers/net/usb/lan78xx.mod.o
   CC [M]  drivers/net/usb/asix.mod.o
   CC [M]  drivers/net/usb/ax88179_178a.mod.o
/usr/bin/ld.bfd: arch/powerpc/boot/wrapper.a(crt0.o): warning: 
relocation against `_platform_stack_top' in read-only section `.text'
/usr/bin/ld.bfd: error: read-only segment has dynamic relocations
make[2]: *** [arch/powerpc/boot/Makefile:386: 
arch/powerpc/boot/zImage.pseries] Error 1
   CC [M]  drivers/net/usb/cdc_ether.mod.o
make[1]: *** [arch/powerpc/Makefile:236: zImage] Error 2
make[1]: *** Waiting for unfinished jobs....

ii) After applying the patch :

Kernel build got successful.

Please feel free to add:

Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com>

Thank you!
Anushree Mathur


      reply	other threads:[~2026-05-26  6:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25 16:16 [PATCH] powerpc/boot: Allow text relocations for pseries wrapper with binutils 2.46+ Amit Machhiwal
2026-05-26  6:44 ` Anushree Mathur [this message]

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=6169bbc4-1829-4b9e-bb2c-a508a001e1b6@linux.ibm.com \
    --to=anushree.mathur@linux.ibm.com \
    --cc=amachhiw@linux.ibm.com \
    --cc=antonio.feijoo@suse.com \
    --cc=chleroy@kernel.org \
    --cc=harshpb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=vaibhav@linux.ibm.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