[PATCH] Fix the error of GET_DATA_POINTER for aarch64 on linux

Tianjia Zhang tianjia.zhang at linux.alibaba.com
Tue May 10 14:49:47 CEST 2022


* cipher/asm-common-aarch64.h: Use same macro GET_DATA_POINTER() for
  linux and windows.
--

For multiple labels defined in the same consts object on Linux,
except the first label, an error result will be obtained when taking
the addresss of other labels through GET_DATA_POINTER(). The error
address is the same as the first label. An error fragment code after
compilation is as follows:

  0x0000fffff7f18be4 <+12>:	adrp	x6, 0xfffff7fb8000
  0x0000fffff7f18be8 <+16>:	ldr	x6, [x6, #3216]
  0x0000fffff7f18bec <+20>:	ld1b	{z24.b}, p0/z, [x6]
  0x0000fffff7f18bf0 <+24>:	adrp	x6, 0xfffff7fb8000
  0x0000fffff7f18bf4 <+28>:	ldr	x6, [x6, #3216]
  0x0000fffff7f18bf8 <+32>:	ldr	p1, [x6]

This patch fixes this problem by using the ADRP/ADD instruction.

Signed-off-by: Tianjia Zhang <tianjia.zhang at linux.alibaba.com>
---
 cipher/asm-common-aarch64.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cipher/asm-common-aarch64.h b/cipher/asm-common-aarch64.h
index d3f7801c7661..b29479a32157 100644
--- a/cipher/asm-common-aarch64.h
+++ b/cipher/asm-common-aarch64.h
@@ -33,7 +33,7 @@
 #define GET_DATA_POINTER(reg, name) \
 	adrp    reg, name at GOTPAGE ; \
 	add     reg, reg, name at GOTPAGEOFF ;
-#elif defined(_WIN32)
+#elif defined(__linux__) || defined(_WIN32)
 #define GET_DATA_POINTER(reg, name) \
 	adrp    reg, name ; \
 	add     reg, reg, #:lo12:name ;
-- 
2.24.3 (Apple Git-128)




More information about the Gcrypt-devel mailing list