Follow @Openwall on Twitter for new release announcements and other news
[<prev] [day] [month] [year] [list]
Message-ID: <20260708131932.718636-1-alex@alexrp.com>
Date: Wed,  8 Jul 2026 15:19:32 +0200
From: Alex Rønne Petersen <alex@...xrp.com>
To: musl@...ts.openwall.com
Cc: Alex Rønne Petersen <alex@...xrp.com>
Subject: [PATCH v2] powerpc64: add nop after b/bl to fix power10 linking

Previously discussed in [0] and [1].

The proper fix here is to use b/bl sym@...oc. As noted in the previous threads,
it seems like the assembler really should be able to infer the @notoc in these
cases, but since LLVM's assembler doesn't in practice, we need to deal with it
somehow.

Unfortunately, binutils only gained support for @notoc in 2018, and lld in 2020.
I'm not sure that we want to take a hard dependency on toolchains that recent,
so simply adding the nop seems like the lesser evil to me, especially
considering these are not particularly hot code paths.

[0] https://www.openwall.com/lists/musl/2025/12/11/4
[1] https://www.openwall.com/lists/musl/2025/12/12/1
---
 arch/powerpc64/crt_arch.h  | 1 +
 src/ldso/powerpc64/dlsym.s | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/powerpc64/crt_arch.h b/arch/powerpc64/crt_arch.h
index 168669a9..c3817def 100644
--- a/arch/powerpc64/crt_arch.h
+++ b/arch/powerpc64/crt_arch.h
@@ -13,6 +13,7 @@ START ": \n"
 "	stdu   0, -32(1) \n"
 "	mtlr   0 \n"
 "	bl " START "_c \n"
+"	nop \n"
 ".weak   _DYNAMIC \n"
 ".hidden _DYNAMIC \n"
 "1:	.long _DYNAMIC-" START "\n"
diff --git a/src/ldso/powerpc64/dlsym.s b/src/ldso/powerpc64/dlsym.s
index a14715fd..73e70db9 100644
--- a/src/ldso/powerpc64/dlsym.s
+++ b/src/ldso/powerpc64/dlsym.s
@@ -8,4 +8,5 @@ dlsym:
 	.localentry dlsym,.-dlsym
 	mflr    5                      # The return address is arg3.
 	b       __dlsym
+	nop
 	.size   dlsym, .-dlsym
-- 
2.53.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.