[PATCH 1/2] aarch64: use configure check for assembly ELF directives support

Jussi Kivilinna jussi.kivilinna at iki.fi
Sat Dec 5 13:32:10 CET 2020


* configure.ac (gcry_cv_gcc_asm_elf_directives): New check.
(HAVE_GCC_ASM_ELF_DIRECTIVES): New 'config.h' macro.
* cipher/asm-common-aarch64.h (ELF): Change feature macro check from
__ELF__ to HAVE_GCC_ASM_ELF_DIRECTIVES.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/asm-common-aarch64.h |  2 +-
 configure.ac                | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/cipher/asm-common-aarch64.h b/cipher/asm-common-aarch64.h
index 4ffc1b71..4e0b6d2e 100644
--- a/cipher/asm-common-aarch64.h
+++ b/cipher/asm-common-aarch64.h
@@ -23,7 +23,7 @@
 
 #include <config.h>
 
-#ifdef __ELF__
+#ifdef HAVE_GCC_ASM_ELF_DIRECTIVES
 # define ELF(...) __VA_ARGS__
 #else
 # define ELF(...) /*_*/
diff --git a/configure.ac b/configure.ac
index e90d46e4..fda74056 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1224,6 +1224,26 @@ if test "$gcry_cv_gcc_asm_cfi_directives" = "yes" ; then
 fi
 
 
+#
+# Check whether GCC assembler supports for ELF directives.
+#
+AC_CACHE_CHECK([whether GCC assembler supports for ELF directives],
+       [gcry_cv_gcc_asm_elf_directives],
+       [gcry_cv_gcc_asm_elf_directives=no
+        AC_LINK_IFELSE([AC_LANG_PROGRAM(
+          [[__asm__(
+                /* Test if ELF directives '.type' and '.size' are supported. */
+                "asmfunc:\n\t"
+                ".size asmfunc,.-asmfunc;\n\t"
+                ".type asmfunc,STT_FUNC;\n\t"
+            );]])],
+          [gcry_cv_gcc_asm_elf_directives=yes])])
+if test "$gcry_cv_gcc_asm_elf_directives" = "yes" ; then
+   AC_DEFINE(HAVE_GCC_ASM_ELF_DIRECTIVES,1,
+             [Defined if underlying assembler supports for ELF directives])
+fi
+
+
 #
 # Check whether underscores in symbols are required.  This needs to be
 # done before setting up the assembler stuff.
-- 
2.27.0




More information about the Gcrypt-devel mailing list