pineapple/externals/vcpkg/ports/nettle/yasm.patch
2022-07-23 03:01:36 +02:00

96 lines
3 KiB
Diff
Executable file

diff --git a/Makefile.in b/Makefile.in
index b65ff4960..3887d0c8f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -291,7 +291,7 @@ libhogweed.a: $(hogweed_OBJS)
%.$(OBJEXT): %.asm $(srcdir)/m4-utils.m4 $(srcdir)/asm.m4 config.m4 machine.m4
$(M4) $(srcdir)/m4-utils.m4 $(srcdir)/asm.m4 config.m4 machine.m4 $< >$*.s
- $(COMPILE) -c $*.s
+ $(COMPILE_AS) -o $*.$(OBJEXT) $*.s
%.$(OBJEXT): %.c
$(COMPILE) -c $< \
diff --git a/config.make.in b/config.make.in
index f8e1f74ef..3ae593385 100644
--- a/config.make.in
+++ b/config.make.in
@@ -73,6 +73,7 @@ TEST_SHLIB_DIR = ${abs_top_builddir}/.lib
# flags before CPPFLAGS and LDFLAGS. While EXTRA_CFLAGS are added at the end.
COMPILE = $(CC) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(DEP_FLAGS)
+COMPILE_AS = $(CCAS) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(ASMFLAGS) $(DEP_FLAGS)
COMPILE_CXX = $(CXX) $(PRE_CPPFLAGS) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) $(DEP_FLAGS)
LINK = $(CC) $(CFLAGS) $(PRE_LDFLAGS) $(LDFLAGS)
LINK_CXX = $(CXX) $(CXXFLAGS) $(PRE_LDFLAGS) $(LDFLAGS)
diff --git a/configure.ac b/configure.ac
index e95f1c825..1d7ef36bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,6 +118,9 @@ LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \
# Checks for programs.
AC_PROG_CC
+# Copied from gmp
+test -n "$CCAS" || CCAS="$CC -c"
+AC_SUBST(CCAS)
NETTLE_CHECK_IFUNC
@@ -302,7 +305,7 @@ ABI=standard
case "$host_cpu" in
[x86_64 | amd64])
AC_TRY_COMPILE([
-#if defined(__x86_64__) || defined(__arch64__)
+#if defined(__x86_64__) || defined(__arch64__) || defined(_M_AMD64)
#error 64-bit x86
#endif
], [], [
diff --git a/x86_64/aes.m4 b/x86_64/aes.m4
index 3bec9eae2..85cafc046 100644
--- a/x86_64/aes.m4
+++ b/x86_64/aes.m4
@@ -77,9 +77,9 @@ define(`AES_STORE', `
dnl AES_ROUND(table,a,b,c,d,out,ptr)
dnl Computes one word of the AES round. Leaves result in $6.
define(`AES_ROUND', `
- movzb LREG($2), $7
+ movzbq LREG($2), $7
movl AES_TABLE0 ($1, $7, 4),$6
- movzb HREG($3), XREG($7)
+ movzbq HREG($3), XREG($7)
xorl AES_TABLE1 ($1, $7, 4),$6
movl $4,XREG($7)
shr `$'16,$7
@@ -94,7 +94,7 @@ dnl Computes one word of the final round. Leaves result in $6. Also
dnl performs the first substitution step, on the least significant
dnl byte, and rotates 8 bits.
define(`AES_FINAL_ROUND', `
- movzb LREG($1),$7
+ movzbq LREG($1),$7
movzbl ($5, $7), $6
movl $2,XREG($7)
andl `$'0x0000ff00,XREG($7)
@@ -113,18 +113,18 @@ dnl each of eax, ebx, ecx and edx, and also rotates
dnl the words one byte to the left.
dnl Uses that AES_SBOX == 0
define(`AES_SUBST_BYTE', `
- movzb LREG($1),$6
+ movzbq LREG($1),$6
movb ($5, $6),LREG($1)
roll `$'8,$1
- movzb LREG($2),$6
+ movzbq LREG($2),$6
movb ($5, $6),LREG($2)
roll `$'8,$2
- movzb LREG($3),$6
+ movzbq LREG($3),$6
movb ($5, $6),LREG($3)
roll `$'8,$3
- movzb LREG($4),$6
+ movzbq LREG($4),$6
movb ($5, $6),LREG($4)
roll `$'8,$4')dnl