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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Jussi Kivilinna-2
* 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 <[hidden email]>
---
 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


_______________________________________________
Gcrypt-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] aarch64: mpi/longlong.h: fix operand size mismatch

Jussi Kivilinna-2
* mpi/longlong.h [__aarch64__] (count_leading_zeros): Use correctly
sized temporary variable for asm output.
--

Patch fixes clang-8 warning about differently sized inline
assembly operands seen on aarch64.

Signed-off-by: Jussi Kivilinna <[hidden email]>
---
 mpi/longlong.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/mpi/longlong.h b/mpi/longlong.h
index c0f24c85..6573c984 100644
--- a/mpi/longlong.h
+++ b/mpi/longlong.h
@@ -305,9 +305,13 @@ extern UDItype __udiv_qrnnd ();
     (ph) = __ph; \
   } while (0)
 # define count_leading_zeros(count, x) \
-  __asm__ ("clz %0, %1\n"                                               \
-           : "=r" ((count))                                             \
-           : "r" ((UDItype)(x)))
+  do {                                                                  \
+    UDItype __co;                                                       \
+    __asm__ ("clz %0, %1\n"                                             \
+             : "=r" (__co)                                              \
+             : "r" ((UDItype)(x)));                                     \
+    (count) = __co;                                                     \
+  } while (0)
 #endif /* __aarch64__ */
 
 /***************************************
--
2.27.0


_______________________________________________
Gcrypt-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel