icp: fix all !ENDBR objtool warnings in x86 Asm code

Currently, only Blake3 x86 Asm code has signs of being ENDBR-aware.
At least, under certain conditions it includes some header file and
uses some custom macro from there.
Linux has its own NOENDBR since several releases ago. It's defined
in the same <asm/linkage.h>, so currently <sys/asm_linkage.h>
already is provided with it.

Let's unify those two into one %ENDBR macro. At first, check if it's
present already. If so -- use Linux kernel version. Otherwise, try
to go that second way and use %_CET_ENDBR from <cet.h> if available.
If no, fall back to just empty definition.
This fixes a couple more 'relocations to !ENDBR' across the module.
And now that we always have the latest/actual ENDBR definition, use
it at the entrance of the few corresponding functions that objtool
still complains about. This matches the way how it's used in the
upstream x86 core Asm code.

Reviewed-by: Attila Fülöp <attila@fueloep.org>
Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Closes #14035
This commit is contained in:
Alexander Lobakin
2022-10-16 23:41:39 +02:00
committed by Brian Behlendorf
parent 61cca6fa05
commit 73b8f700b6
10 changed files with 41 additions and 50 deletions
+1 -11
View File
@@ -30,16 +30,6 @@
#define _ASM
#include <sys/asm_linkage.h>
#if defined(__ELF__) && defined(__CET__) && defined(__has_include)
#if __has_include(<cet.h>)
#include <cet.h>
#endif
#endif
#if !defined(_CET_ENDBR)
#define _CET_ENDBR
#endif
.intel_syntax noprefix
.global zfs_blake3_hash_many_avx2
.text
@@ -47,7 +37,7 @@
.type zfs_blake3_hash_many_avx2,@function
.p2align 6
zfs_blake3_hash_many_avx2:
_CET_ENDBR
ENDBR
push r15
push r14
push r13
+3 -13
View File
@@ -30,16 +30,6 @@
#define _ASM
#include <sys/asm_linkage.h>
#if defined(__ELF__) && defined(__CET__) && defined(__has_include)
#if __has_include(<cet.h>)
#include <cet.h>
#endif
#endif
#if !defined(_CET_ENDBR)
#define _CET_ENDBR
#endif
.intel_syntax noprefix
.global zfs_blake3_hash_many_avx512
.global zfs_blake3_compress_in_place_avx512
@@ -52,7 +42,7 @@
.p2align 6
zfs_blake3_hash_many_avx512:
_CET_ENDBR
ENDBR
push r15
push r14
push r13
@@ -2409,7 +2399,7 @@ zfs_blake3_hash_many_avx512:
jmp 4b
.p2align 6
zfs_blake3_compress_in_place_avx512:
_CET_ENDBR
ENDBR
vmovdqu xmm0, xmmword ptr [rdi]
vmovdqu xmm1, xmmword ptr [rdi+0x10]
movzx eax, r8b
@@ -2491,7 +2481,7 @@ zfs_blake3_compress_in_place_avx512:
.p2align 6
zfs_blake3_compress_xof_avx512:
_CET_ENDBR
ENDBR
vmovdqu xmm0, xmmword ptr [rdi]
vmovdqu xmm1, xmmword ptr [rdi+0x10]
movzx eax, r8b
+3 -13
View File
@@ -30,16 +30,6 @@
#define _ASM
#include <sys/asm_linkage.h>
#if defined(__ELF__) && defined(__CET__) && defined(__has_include)
#if __has_include(<cet.h>)
#include <cet.h>
#endif
#endif
#if !defined(_CET_ENDBR)
#define _CET_ENDBR
#endif
.intel_syntax noprefix
.global zfs_blake3_hash_many_sse2
.global zfs_blake3_compress_in_place_sse2
@@ -52,7 +42,7 @@
.p2align 6
zfs_blake3_hash_many_sse2:
_CET_ENDBR
ENDBR
push r15
push r14
push r13
@@ -2050,7 +2040,7 @@ zfs_blake3_hash_many_sse2:
.p2align 6
zfs_blake3_compress_in_place_sse2:
_CET_ENDBR
ENDBR
movups xmm0, xmmword ptr [rdi]
movups xmm1, xmmword ptr [rdi+0x10]
movaps xmm2, xmmword ptr [BLAKE3_IV+rip]
@@ -2161,7 +2151,7 @@ zfs_blake3_compress_in_place_sse2:
.p2align 6
zfs_blake3_compress_xof_sse2:
_CET_ENDBR
ENDBR
movups xmm0, xmmword ptr [rdi]
movups xmm1, xmmword ptr [rdi+0x10]
movaps xmm2, xmmword ptr [BLAKE3_IV+rip]
+3 -13
View File
@@ -30,16 +30,6 @@
#define _ASM
#include <sys/asm_linkage.h>
#if defined(__ELF__) && defined(__CET__) && defined(__has_include)
#if __has_include(<cet.h>)
#include <cet.h>
#endif
#endif
#if !defined(_CET_ENDBR)
#define _CET_ENDBR
#endif
.intel_syntax noprefix
.global zfs_blake3_compress_in_place_sse41
.global zfs_blake3_compress_xof_sse41
@@ -52,7 +42,7 @@
.p2align 6
zfs_blake3_hash_many_sse41:
_CET_ENDBR
ENDBR
push r15
push r14
push r13
@@ -1812,7 +1802,7 @@ zfs_blake3_hash_many_sse41:
jmp 4b
.p2align 6
zfs_blake3_compress_in_place_sse41:
_CET_ENDBR
ENDBR
movups xmm0, xmmword ptr [rdi]
movups xmm1, xmmword ptr [rdi+0x10]
movaps xmm2, xmmword ptr [BLAKE3_IV+rip]
@@ -1911,7 +1901,7 @@ zfs_blake3_compress_in_place_sse41:
RET
.p2align 6
zfs_blake3_compress_xof_sse41:
_CET_ENDBR
ENDBR
movups xmm0, xmmword ptr [rdi]
movups xmm1, xmmword ptr [rdi+0x10]
movaps xmm2, xmmword ptr [BLAKE3_IV+rip]