[PATCH] crypto: powerpc/poly1305 - Add missing poly1305_emit_arch

Herbert Xu
2025-05-07T11:37:08Z

On Wed, May 07, 2025 at 01:03:06PM +0200, Thorsten Leemhuis wrote:
>
> """
> ld: warning: discarding dynamic section .glink
> ld: warning: discarding dynamic section .plt
> ld: linkage table error against `poly1305_emit_arch'
> ld: stubs don't match calculated size
> ld: can not build stubs: bad value
> ld: lib/crypto/poly1305.o: in function `poly1305_final':
> /builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250507/linux-6.15.0-0.0.next.20250507.443.vanilla.fc43.ppc64le/lib/crypto/poly1305.c:65:(.text+0x2dc): undefined reference to `poly1305_emit_arch'
> ld: /builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250507/linux-6.15.0-0.0.next.20250507.443.vanilla.fc43.ppc64le/lib/crypto/poly1305.c:65:(.text+0x378): undefined reference to `poly1305_emit_arch'
> make[2]: *** [scripts/Makefile.vmlinux:91: vmlinux] Error 1
> make[1]: *** [/builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250507/linux-6.15.0-0.0.next.20250507.443.vanilla.fc43.ppc64le/Makefile:1250: vmlinux] Error 2
> """

Oops, the powerpc patch was missing the assembly part:

---8<---
Rename poly1305_emit_64 to poly1305_emit_arch to conform with
the expectation of the poly1305 library.

Reported-by: Thorsten Leemhuis <linux@leemhuis.info>
Fixes: 14d31979145d ("crypto: powerpc/poly1305 - Add block-only interface")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/arch/powerpc/lib/crypto/poly1305-p10-glue.c b/arch/powerpc/lib/crypto/poly1305-p10-glue.c
index 16c2a8316696..7cea0ebcc6bc 100644
--- a/arch/powerpc/lib/crypto/poly1305-p10-glue.c
+++ b/arch/powerpc/lib/crypto/poly1305-p10-glue.c
@@ -17,6 +17,7 @@ asmlinkage void poly1305_64s(struct poly1305_block_state *state, const u8 *m, u3
asmlinkage void poly1305_emit_arch(const struct poly1305_state *state,
u8 digest[POLY1305_DIGEST_SIZE],
const u32 nonce[4]);
+EXPORT_SYMBOL_GPL(poly1305_emit_arch);

static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_p10);

diff --git a/arch/powerpc/lib/crypto/poly1305-p10le_64.S b/arch/powerpc/lib/crypto/poly1305-p10le_64.S
index a3c1987f1ecd..2ba2911b8038 100644
--- a/arch/powerpc/lib/crypto/poly1305-p10le_64.S
+++ b/arch/powerpc/lib/crypto/poly1305-p10le_64.S
@@ -1030,7 +1030,7 @@ SYM_FUNC_END(poly1305_64s)
# Input: r3 = h, r4 = s, r5 = mac
# mac = h + s
#
-SYM_FUNC_START(poly1305_emit_64)
+SYM_FUNC_START(poly1305_emit_arch)
ld 10, 0(3)
ld 11, 8(3)
ld 12, 16(3)
@@ -1060,7 +1060,7 @@ Skip_h64:
std 10, 0(5)
std 11, 8(5)
blr
-SYM_FUNC_END(poly1305_emit_64)
+SYM_FUNC_END(poly1305_emit_arch)

SYM_DATA_START_LOCAL(RMASK)
.align 5