Skip to contentSkip to conversation

lib/crypto: x86/sha512: Drop unnecessary ANNOTATE_NOENDBR

PATCH In review Eric Biggers 2 participants 2 messages Jun 27, 2025 – Jul 8, 2025

Subsystems (2)
lore
Share & tools
lore

Eric Biggers

author maintainer
#0 lore raw

PATCH 1/1 lib/crypto: x86/sha512: Drop unnecessary ANNOTATE_NOENDBR

When migrating the x86 SHA-512 assembly code to lib/crypto/, I replaced SYM_TYPED_FUNC_START with ANNOTATE_NOENDBR. This was intended to match a change in the caller from an indirect call to a static call, like what I did for SHA-256. However, for SHA-512 I actually decided to bring the static call up a level; see DEFINE_X86_SHA512_FN in lib/crypto/x86/sha512.h. Therefore, now the assembly functions are just called via normal direct calls. At least for SHA this seems to be the better way to do it, and it means using ANNOTATE_NOENDBR is unnecessary.

Fixes b82535bf96da ("lib/crypto: x86/sha512: Migrate optimized SHA-512 code to library")

---

This patch is targeting libcrypto-next.

 lib/crypto/x86/sha512-avx-asm.S   | 2 --
 lib/crypto/x86/sha512-avx2-asm.S  | 2 --
 lib/crypto/x86/sha512-ssse3-asm.S | 2 --
 3 files changed, 6 deletions(-)
lib/crypto/x86/sha512-avx-asm.S +0 -2
index af7ea311cc945..7732aa8fd8506 100644
@@ -46,11 +46,10 @@
 # and search for that title.
 #
 ########################################################################
 
 #include <linux/linkage.h>
-#include <linux/objtool.h>
 
 .text
 
 # Virtual Registers
 # ARG1
@@ -274,11 +273,10 @@ frame_size = frame_WK + WK_SIZE
 # The size of the message pointed to by "data" must be an integer multiple
 # of SHA512 message blocks.
 # "nblocks" is the message length in SHA512 blocks.  Must be >= 1.
 ########################################################################
 SYM_FUNC_START(sha512_transform_avx)
-	ANNOTATE_NOENDBR	# since this is called only via static_call
 
 	# Save GPRs
 	push	%rbx
 	push	%r12
 	push	%r13
lib/crypto/x86/sha512-avx2-asm.S +0 -2
index 1302ddb5ec8cc..22bdbfd899d0f 100644
@@ -48,11 +48,10 @@
 ########################################################################
 # This code schedules 1 blocks at a time, with 4 lanes per block
 ########################################################################
 
 #include <linux/linkage.h>
-#include <linux/objtool.h>
 
 .text
 
 # Virtual Registers
 Y_0 = %ymm4
@@ -566,11 +565,10 @@ frame_size = frame_CTX + CTX_SIZE
 # The size of the message pointed to by "data" must be an integer multiple
 # of SHA512 message blocks.
 # "nblocks" is the message length in SHA512 blocks.  Must be >= 1.
 ########################################################################
 SYM_FUNC_START(sha512_transform_rorx)
-	ANNOTATE_NOENDBR	# since this is called only via static_call
 
 	# Save GPRs
 	push	%rbx
 	push	%r12
 	push	%r13
lib/crypto/x86/sha512-ssse3-asm.S +0 -2
index 108f1accc6bc7..4cae7445b2a86 100644
@@ -46,11 +46,10 @@
 # and search for that title.
 #
 ########################################################################
 
 #include <linux/linkage.h>
-#include <linux/objtool.h>
 
 .text
 
 # Virtual Registers
 # ARG1
@@ -273,11 +272,10 @@ frame_size = frame_WK + WK_SIZE
 # The size of the message pointed to by "data" must be an integer multiple
 # of SHA512 message blocks.
 # "nblocks" is the message length in SHA512 blocks.  Must be >= 1.
 ########################################################################
 SYM_FUNC_START(sha512_transform_ssse3)
-	ANNOTATE_NOENDBR	# since this is called only via static_call
 
 	# Save GPRs
 	push	%rbx
 	push	%r12
 	push	%r13

base-commit: d74152ec2b5106263c2a502380acfaf5954f9898

Signature · 1 line
2.50.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines · Eric Biggers

When migrating the x86 SHA-512 assembly code to lib/crypto/, I replaced SYM_TYPED_FUNC_START with ANNOTATE_NOENDBR. This was intended to match a change in the caller from an indirect call to a static call, like what I did for SHA-256. However, for SHA-512 I actually decided to bring the static call up a level; see DEFINE_X86_SHA512_FN in lib/crypto/x86/sha512.h. Therefore, now the assembly functions are just called via normal direct calls. At least for SHA this seems to be the better way to do it, and it means using ANNOTATE_NOENDBR is unnecessary.

Fixes b82535bf96da ("lib/crypto: x86/sha512: Migrate optimized SHA-512 code to library")
Quoted 9 lines

---

This patch is targeting libcrypto-next.

 lib/crypto/x86/sha512-avx-asm.S   | 2 --
 lib/crypto/x86/sha512-avx2-asm.S  | 2 --
 lib/crypto/x86/sha512-ssse3-asm.S | 2 --
 3 files changed, 6 deletions(-)
Quoted 89 lines
lib/crypto/x86/sha512-avx-asm.S +0 -2
index af7ea311cc945..7732aa8fd8506 100644
@@ -46,11 +46,10 @@
 # and search for that title.
 #
 ########################################################################
 
 #include <linux/linkage.h>
-#include <linux/objtool.h>
 
 .text
 
 # Virtual Registers
 # ARG1
@@ -274,11 +273,10 @@ frame_size = frame_WK + WK_SIZE
 # The size of the message pointed to by "data" must be an integer multiple
 # of SHA512 message blocks.
 # "nblocks" is the message length in SHA512 blocks.  Must be >= 1.
 ########################################################################
 SYM_FUNC_START(sha512_transform_avx)
-       ANNOTATE_NOENDBR        # since this is called only via static_call
 
        # Save GPRs
        push    %rbx
        push    %r12
        push    %r13
lib/crypto/x86/sha512-avx2-asm.S +0 -2
index 1302ddb5ec8cc..22bdbfd899d0f 100644
@@ -48,11 +48,10 @@
 ########################################################################
 # This code schedules 1 blocks at a time, with 4 lanes per block
 ########################################################################
 
 #include <linux/linkage.h>
-#include <linux/objtool.h>
 
 .text
 
 # Virtual Registers
 Y_0 = %ymm4
@@ -566,11 +565,10 @@ frame_size = frame_CTX + CTX_SIZE
 # The size of the message pointed to by "data" must be an integer multiple
 # of SHA512 message blocks.
 # "nblocks" is the message length in SHA512 blocks.  Must be >= 1.
 ########################################################################
 SYM_FUNC_START(sha512_transform_rorx)
-       ANNOTATE_NOENDBR        # since this is called only via static_call
 
        # Save GPRs
        push    %rbx
        push    %r12
        push    %r13
lib/crypto/x86/sha512-ssse3-asm.S +0 -2
index 108f1accc6bc7..4cae7445b2a86 100644
@@ -46,11 +46,10 @@
 # and search for that title.
 #
 ########################################################################
 
 #include <linux/linkage.h>
-#include <linux/objtool.h>
 
 .text
 
 # Virtual Registers
 # ARG1
@@ -273,11 +272,10 @@ frame_size = frame_WK + WK_SIZE
 # The size of the message pointed to by "data" must be an integer multiple
 # of SHA512 message blocks.
 # "nblocks" is the message length in SHA512 blocks.  Must be >= 1.
 ########################################################################
 SYM_FUNC_START(sha512_transform_ssse3)
-       ANNOTATE_NOENDBR        # since this is called only via static_call
 
        # Save GPRs
        push    %rbx
        push    %r12
        push    %r13

base-commit: d74152ec2b5106263c2a502380acfaf5954f9898 --
2.50.0