[PATCH 4/4] configure: fix HAVE_GCC_ASM_CFI_DIRECTIVES check

Jussi Kivilinna jussi.kivilinna at iki.fi
Mon Jul 10 20:07:03 CEST 2023


* cipher/camellia-aesni-avx2-amd64.h (enc_blk1_32): Fix dual
CFI_ENDPROC() usage.
* configure.ac (gcry_cv_gcc_asm_cfi_directives): Add missing ';'
after 'void asmfunc(void)'.
* mpi/asm-common-i386.h: New.
* mpi/i386/syntax.h: Remove CFI macros and instead include
"asm-common-i386.h".
--

This was broken by commit 693ffa145378682229473b0e811a9cea7c4d307a
"build: Fix configure.ac for strict C99."

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/camellia-aesni-avx2-amd64.h | 21 ++++++++++-----------
 configure.ac                       |  3 +--
 mpi/asm-common-i386.h              | 26 ++++++++++++++++++++++++++
 mpi/i386/syntax.h                  | 22 +---------------------
 4 files changed, 38 insertions(+), 34 deletions(-)
 create mode 100644 mpi/asm-common-i386.h

diff --git a/cipher/camellia-aesni-avx2-amd64.h b/cipher/camellia-aesni-avx2-amd64.h
index dff8b386..4c3fb4b2 100644
--- a/cipher/camellia-aesni-avx2-amd64.h
+++ b/cipher/camellia-aesni-avx2-amd64.h
@@ -2198,16 +2198,7 @@ FUNC_NAME(enc_blk1_32):
 	STORE_OUTPUT(ymm10, 13);
 	STORE_OUTPUT(ymm9, 14);
 	STORE_OUTPUT(ymm8, 15);
-
-.align 8
-2:
-.Lenc_blk32_done:
-	vzeroall;
-
-	leave;
-	CFI_LEAVE();
-	ret_spec_stop;
-	CFI_ENDPROC();
+	jmp .Lenc_blk32_done;
 
 .align 8
 .Lenc_blk32:
@@ -2220,7 +2211,15 @@ FUNC_NAME(enc_blk1_32):
 	write_output(%ymm7, %ymm6, %ymm5, %ymm4, %ymm3, %ymm2, %ymm1, %ymm0,
 		     %ymm15, %ymm14, %ymm13, %ymm12, %ymm11, %ymm10, %ymm9,
 		     %ymm8, %rsi);
-	jmp .Lenc_blk32_done;
+
+.align 8
+2:
+.Lenc_blk32_done:
+	vzeroall;
+
+	leave;
+	CFI_LEAVE();
+	ret_spec_stop;
 	CFI_ENDPROC();
 ELF(.size FUNC_NAME(enc_blk1_32),.-FUNC_NAME(enc_blk1_32);)
 
diff --git a/configure.ac b/configure.ac
index 72596f30..c14e8fe8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1244,8 +1244,7 @@ AC_CACHE_CHECK([whether GCC assembler supports for CFI directives],
                 ".cfi_restore_state\n\t"
                 ".long 0\n\t"
                 ".cfi_endproc\n\t"
-            );
-            void asmfunc(void)]])],
+            );]])],
           [gcry_cv_gcc_asm_cfi_directives=yes])])
 if test "$gcry_cv_gcc_asm_cfi_directives" = "yes" ; then
    AC_DEFINE(HAVE_GCC_ASM_CFI_DIRECTIVES,1,
diff --git a/mpi/asm-common-i386.h b/mpi/asm-common-i386.h
new file mode 100644
index 00000000..90166450
--- /dev/null
+++ b/mpi/asm-common-i386.h
@@ -0,0 +1,26 @@
+/* asm-common-i386.h  -  Common macros for AMD64 assembly
+ *
+ * Copyright (C) 2023 Jussi Kivilinna <jussi.kivilinna at iki.fi>
+ *
+ * This file is part of Libgcrypt.
+ *
+ * Libgcrypt is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * Libgcrypt is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MPI_ASM_COMMON_I386_H
+#define MPI_ASM_COMMON_I386_H
+
+#include "../cipher/asm-common-i386.h"
+
+#endif /* MPI_ASM_COMMON_I386_H */
diff --git a/mpi/i386/syntax.h b/mpi/i386/syntax.h
index 8dbdc52c..2383ebd3 100644
--- a/mpi/i386/syntax.h
+++ b/mpi/i386/syntax.h
@@ -29,27 +29,7 @@
 #include <config.h>
 
 #ifdef __i386__
-#ifdef HAVE_GCC_ASM_CFI_DIRECTIVES
-# define CFI_STARTPROC()            .cfi_startproc
-# define CFI_ENDPROC()              .cfi_endproc
-# define CFI_ADJUST_CFA_OFFSET(off) .cfi_adjust_cfa_offset off
-# define CFI_REL_OFFSET(reg,off)    .cfi_rel_offset reg, off
-# define CFI_RESTORE(reg)           .cfi_restore reg
-
-# define CFI_PUSH(reg) \
-	CFI_ADJUST_CFA_OFFSET(4); CFI_REL_OFFSET(reg, 0)
-# define CFI_POP(reg) \
-	CFI_ADJUST_CFA_OFFSET(-4); CFI_RESTORE(reg)
-#else
-# define CFI_STARTPROC()
-# define CFI_ENDPROC()
-# define CFI_ADJUST_CFA_OFFSET(off)
-# define CFI_REL_OFFSET(reg,off)
-# define CFI_RESTORE(reg)
-
-# define CFI_PUSH(reg)
-# define CFI_POP(reg)
-#endif
+#include "asm-common-i386.h"
 #endif
 
 #undef ALIGN
-- 
2.39.2




More information about the Gcrypt-devel mailing list