LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/boot: Allow text relocations for pseries wrapper with binutils 2.46+
@ 2026-05-25 16:16 Amit Machhiwal
  2026-05-26  6:44 ` Anushree Mathur
  0 siblings, 1 reply; 2+ messages in thread
From: Amit Machhiwal @ 2026-05-25 16:16 UTC (permalink / raw)
  To: Madhavan Srinivasan, linuxppc-dev
  Cc: Amit Machhiwal, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy (CS GROUP), Antonio Alvarez Feijoo, Vaibhav Jain,
	Harsh Prateek Bora, Anushree Mathur, linux-kernel

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
-- 
2.50.1 (Apple Git-155)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-26  6:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox