Skip to contentSkip to conversation

x86/crc: add ANNOTATE_NOENDBR to suppress objtool warnings

PATCH In review Eric Biggers 2 participants 2 messages Feb 17, 2025 – Feb 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/crc: add ANNOTATE_NOENDBR to suppress objtool warnings

From: Eric Biggers <[email protected]>

The assembly functions generated by crc-pclmul-template.S are called only via static_call, so they do not need to begin with an endbr instruction. But objtool still warns about a missing endbr by default. Add ANNOTATE_NOENDBR to suppress these warnings:

    vmlinux.o: warning: objtool: crc32_x86_init+0x1c0: relocation to !ENDBR: crc32_lsb_vpclmul_avx10_256+0x0
    vmlinux.o: warning: objtool: crc64_x86_init+0x183: relocation to !ENDBR: crc64_msb_vpclmul_avx10_256+0x0
    vmlinux.o: warning: objtool: crc_t10dif_x86_init+0x183: relocation to !ENDBR: crc16_msb_vpclmul_avx10_256+0x0
    vmlinux.o: warning: objtool: __SCK__crc32_lsb_pclmul+0x0: data relocation to !ENDBR: crc32_lsb_pclmul_sse+0x0
    vmlinux.o: warning: objtool: __SCK__crc64_lsb_pclmul+0x0: data relocation to !ENDBR: crc64_lsb_pclmul_sse+0x0
    vmlinux.o: warning: objtool: __SCK__crc64_msb_pclmul+0x0: data relocation to !ENDBR: crc64_msb_pclmul_sse+0x0
    vmlinux.o: warning: objtool: __SCK__crc16_msb_pclmul+0x0: data relocation to !ENDBR: crc16_msb_pclmul_sse+0x0
Fixes 8d2d3e72e35b ("x86/crc: add "template" for [V]PCLMULQDQ based CRC functions")

---

This applies to
https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next

 arch/x86/lib/crc-pclmul-template.S | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/lib/crc-pclmul-template.S +5 -0
index dc91cc074b300..a19b730b642d3 100644
@@ -5,10 +5,11 @@
 // Copyright 2025 Google LLC
 //
 // Author: Eric Biggers <[email protected]>
 
 #include <linux/linkage.h>
+#include <linux/objtool.h>
 
 // Offsets within the generated constants table
 .set OFFSETOF_BSWAP_MASK,			-5*16	// msb-first CRCs only
 .set OFFSETOF_FOLD_ACROSS_2048_BITS_CONSTS,	-4*16	// must precede next
 .set OFFSETOF_FOLD_ACROSS_1024_BITS_CONSTS,	-3*16	// must precede next
@@ -270,10 +271,14 @@
 	.set	BSWAP_MASK_XMM,	%xmm6
 	.set	CONSTS,		V7
 	.set	CONSTS_YMM,	%ymm7
 	.set	CONSTS_XMM,	%xmm7
 
+	// Use ANNOTATE_NOENDBR to suppress an objtool warning, since the
+	// functions generated by this macro are called only by static_call.
+	ANNOTATE_NOENDBR
+
 #ifdef __i386__
 	push		CONSTS_PTR
 	mov		8(%esp), CONSTS_PTR
 #endif
 

base-commit: cf1ea3a7c1f63cba7d1dd313ee3accde0c0c8988

Signature · 1 line
2.48.1
Acked-by on v1 1/1
#1 lore raw
Quoted 45 lines · Eric Biggers

From: Eric Biggers <[email protected]>

The assembly functions generated by crc-pclmul-template.S are called only via static_call, so they do not need to begin with an endbr instruction. But objtool still warns about a missing endbr by default. Add ANNOTATE_NOENDBR to suppress these warnings:

    vmlinux.o: warning: objtool: crc32_x86_init+0x1c0: relocation to !ENDBR: crc32_lsb_vpclmul_avx10_256+0x0
    vmlinux.o: warning: objtool: crc64_x86_init+0x183: relocation to !ENDBR: crc64_msb_vpclmul_avx10_256+0x0
    vmlinux.o: warning: objtool: crc_t10dif_x86_init+0x183: relocation to !ENDBR: crc16_msb_vpclmul_avx10_256+0x0
    vmlinux.o: warning: objtool: __SCK__crc32_lsb_pclmul+0x0: data relocation to !ENDBR: crc32_lsb_pclmul_sse+0x0
    vmlinux.o: warning: objtool: __SCK__crc64_lsb_pclmul+0x0: data relocation to !ENDBR: crc64_lsb_pclmul_sse+0x0
    vmlinux.o: warning: objtool: __SCK__crc64_msb_pclmul+0x0: data relocation to !ENDBR: crc64_msb_pclmul_sse+0x0
    vmlinux.o: warning: objtool: __SCK__crc16_msb_pclmul+0x0: data relocation to !ENDBR: crc16_msb_pclmul_sse+0x0
Fixes 8d2d3e72e35b ("x86/crc: add "template" for [V]PCLMULQDQ based CRC functions")

---

This applies to
https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=crc-next

 arch/x86/lib/crc-pclmul-template.S | 5 +++++
 1 file changed, 5 insertions(+)
arch/x86/lib/crc-pclmul-template.S +1 -0
index dc91cc074b300..a19b730b642d3 100644
@@ -5,10 +5,11 @@
 // Copyright 2025 Google LLC
 //
 // Author: Eric Biggers <[email protected]>
 
 #include <linux/linkage.h>
+#include <linux/objtool.h>
 
 // Offsets within the generated constants table
 .set OFFSETOF_BSWAP_MASK,			-5*16	// msb-first CRCs only
 .set OFFSETOF_FOLD_ACROSS_2048_BITS_CONSTS,	-4*16	// must precede next
 .set OFFSETOF_FOLD_ACROSS_1024_BITS_CONSTS,	-3*16	// must precede next

arch/x86/lib/crc-pclmul-template.S line 278

Quoted 8 lines
arch/x86/lib/crc-pclmul-template.S +3 -0
@@ -270,10 +271,14 @@
 	.set	BSWAP_MASK_XMM,	%xmm6
 	.set	CONSTS,		V7
 	.set	CONSTS_YMM,	%ymm7
 	.set	CONSTS_XMM,	%xmm7
 
+	// Use ANNOTATE_NOENDBR to suppress an objtool warning, since the
+	// functions generated by this macro are called only by static_call.
+	ANNOTATE_NOENDBR

Thanks,

Ingo