Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions ports/gmp/arm64-coff.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
diff --git a/configure.ac b/configure.ac
index bd92bc4..bd2c0af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3704,6 +3704,8 @@ if test "$gmp_asm_syntax_testing" != no; then
case $host in
*-*-darwin*)
GMP_INCLUDE_MPN(arm64/darwin.m4) ;;
+ *-pc-mingw32)
+ GMP_INCLUDE_MPN(arm64/coff.m4) ;;
*)
GMP_INCLUDE_MPN(arm64/arm64-defs.m4) ;;
esac
diff --git a/mpn/arm64/coff.m4 b/mpn/arm64/coff.m4
new file mode 100644
index 0000000..88605b3
--- /dev/null
+++ b/mpn/arm64/coff.m4
@@ -0,0 +1,54 @@
+divert(-1)
+
+dnl m4 macros for ARM64 COFF assembler.
+
+dnl Copyright 2020 Free Software Foundation, Inc.
+
+dnl This file is part of the GNU MP Library.
+dnl
+dnl The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of either:
+dnl
+dnl * the GNU Lesser General Public License as published by the Free
+dnl Software Foundation; either version 3 of the License, or (at your
+dnl option) any later version.
+dnl
+dnl or
+dnl
+dnl * the GNU General Public License as published by the Free Software
+dnl Foundation; either version 2 of the License, or (at your option) any
+dnl later version.
+dnl
+dnl or both in parallel, as here.
+dnl
+dnl The GNU MP Library is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+dnl for more details.
+dnl
+dnl You should have received copies of the GNU General Public License and the
+dnl GNU Lesser General Public License along with the GNU MP Library. If not,
+dnl see https://www.gnu.org/licenses/.
+
+
+dnl Standard commenting is with @, the default m4 # is for constants and we
+dnl don't want to disable macro expansions in or after them.
+
+changecom
+
+
+dnl LEA_HI(reg,gmp_symbol), LEA_LO(reg,gmp_symbol)
+dnl
+dnl Load the address of gmp_symbol into a register. We split this into two
+dnl parts to allow separation for manual insn scheduling.
+
+define(`LEA_HI', `ldr $1, =$2')dnl
+define(`LEA_LO')dnl
+
+dnl Usage: ALIGN(bytes)
+dnl
+dnl Emit a ".align" directive.
+
+define(`ALIGN', ` .align 8')dnl
+
+divert`'dnl
41 changes: 2 additions & 39 deletions ports/gmp/yasm.patch → ports/gmp/asmflags.patch
Original file line number Diff line number Diff line change
Expand Up @@ -33,51 +33,14 @@ diff --git a/mpn/Makeasm.am b/mpn/Makeasm.am
index 5d7306c22..75692128d 100644
--- a/mpn/Makeasm.am
+++ b/mpn/Makeasm.am
@@ -32,7 +32,7 @@
# COMPILE minus CC.
#
COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
+ $(CPPFLAGS) $(ASMFLAGS)
@@ -31,8 +31,9 @@

# Flags used for preprocessing (in ansi2knr rules).
#
diff --git a/mpn/Makefile.in b/mpn/Makefile.in
index 2bc061012..59c805976 100644
--- a/mpn/Makefile.in
+++ b/mpn/Makefile.in
@@ -403,7 +403,7 @@ EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST)
# COMPILE minus CC.
#
+# Only used with CCAS
COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
+ $(CPPFLAGS) $(ASMFLAGS)


# Flags used for preprocessing (in ansi2knr rules).
diff --git a/tests/Makefile.in b/tests/Makefile.in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Makefile.in is generated from Makefile.am.

index 9742a4016..430603cef 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -666,7 +666,7 @@ SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx
# COMPILE minus CC.
#
COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
+ $(CPPFLAGS) $(ASMFLAGS)


# Flags used for preprocessing (in ansi2knr rules).
diff --git a/tune/Makefile.in b/tune/Makefile.in
index f82cd13e2..351bcd9b1 100644
--- a/tune/Makefile.in
+++ b/tune/Makefile.in
@@ -549,7 +549,7 @@ TUNE_MPN_SRCS_BASIC = div_qr_2.c bdiv_q.c bdiv_qr.c \
# COMPILE minus CC.
#
COMPILE_FLAGS = $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(ASMFLAGS)
+ $(CPPFLAGS) $(ASMFLAGS)


# Flags used for preprocessing (in ansi2knr rules).
102 changes: 102 additions & 0 deletions ports/gmp/cross-tools.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
diff --git a/Makefile.am b/Makefile.am
index 1c24694..9f92a4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,7 @@
+# Using native tools, either this build or from host triplet
+HOST_TOOLS_PREFIX ?= .
+CC_FOR_BUILD = $(CC) $(CPPFLAGS) $(CFLAGS)
+
## Process this file with automake to generate Makefile.in


@@ -344,8 +348,8 @@ install-data-hook:

EXTRA_DIST += bootstrap.c

-fac_table.h: gen-fac$(EXEEXT_FOR_BUILD)
- ./gen-fac $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fac_table.h || (rm -f fac_table.h; exit 1)
+fac_table.h: $(HOST_TOOLS_PREFIX)/gen-fac$(EXEEXT_FOR_BUILD)
+ $(HOST_TOOLS_PREFIX)/gen-fac $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fac_table.h || (rm -f fac_table.h; exit 1)
BUILT_SOURCES += fac_table.h

gen-fac$(EXEEXT_FOR_BUILD): gen-fac$(U_FOR_BUILD).c bootstrap.c
@@ -354,12 +358,12 @@ DISTCLEANFILES += gen-fac$(EXEEXT_FOR_BUILD)
EXTRA_DIST += gen-fac.c


-fib_table.h: gen-fib$(EXEEXT_FOR_BUILD)
- ./gen-fib header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1)
+fib_table.h: $(HOST_TOOLS_PREFIX)/gen-fib$(EXEEXT_FOR_BUILD)
+ $(HOST_TOOLS_PREFIX)/gen-fib header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1)
BUILT_SOURCES += fib_table.h

-mpn/fib_table.c: gen-fib$(EXEEXT_FOR_BUILD)
- ./gen-fib table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1)
+mpn/fib_table.c: $(HOST_TOOLS_PREFIX)/gen-fib$(EXEEXT_FOR_BUILD)
+ $(HOST_TOOLS_PREFIX)/gen-fib table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1)
BUILT_SOURCES += mpn/fib_table.c

gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c bootstrap.c
@@ -368,12 +372,12 @@ DISTCLEANFILES += gen-fib$(EXEEXT_FOR_BUILD)
EXTRA_DIST += gen-fib.c


-mp_bases.h: gen-bases$(EXEEXT_FOR_BUILD)
- ./gen-bases header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1)
+mp_bases.h: $(HOST_TOOLS_PREFIX)/gen-bases$(EXEEXT_FOR_BUILD)
+ $(HOST_TOOLS_PREFIX)/gen-bases header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1)
BUILT_SOURCES += mp_bases.h

-mpn/mp_bases.c: gen-bases$(EXEEXT_FOR_BUILD)
- ./gen-bases table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1)
+mpn/mp_bases.c: $(HOST_TOOLS_PREFIX)/gen-bases$(EXEEXT_FOR_BUILD)
+ $(HOST_TOOLS_PREFIX)/gen-bases table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1)
BUILT_SOURCES += mpn/mp_bases.c

gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c bootstrap.c
@@ -382,8 +386,8 @@ DISTCLEANFILES += gen-bases$(EXEEXT_FOR_BUILD)
EXTRA_DIST += gen-bases.c


-trialdivtab.h: gen-trialdivtab$(EXEEXT_FOR_BUILD)
- ./gen-trialdivtab $(GMP_LIMB_BITS) 8000 >trialdivtab.h || (rm -f trialdivtab.h; exit 1)
+trialdivtab.h: $(HOST_TOOLS_PREFIX)/gen-trialdivtab$(EXEEXT_FOR_BUILD)
+ $(HOST_TOOLS_PREFIX)/gen-trialdivtab $(GMP_LIMB_BITS) 8000 >trialdivtab.h || (rm -f trialdivtab.h; exit 1)
BUILT_SOURCES += trialdivtab.h

gen-trialdivtab$(EXEEXT_FOR_BUILD): gen-trialdivtab$(U_FOR_BUILD).c bootstrap.c
@@ -392,8 +396,8 @@ DISTCLEANFILES += gen-trialdivtab$(EXEEXT_FOR_BUILD)
EXTRA_DIST += gen-trialdivtab.c


-mpn/jacobitab.h: gen-jacobitab$(EXEEXT_FOR_BUILD)
- ./gen-jacobitab >mpn/jacobitab.h || (rm -f mpn/jacobitab.h; exit 1)
+mpn/jacobitab.h: $(HOST_TOOLS_PREFIX)/gen-jacobitab$(EXEEXT_FOR_BUILD)
+ $(HOST_TOOLS_PREFIX)/gen-jacobitab >mpn/jacobitab.h || (rm -f mpn/jacobitab.h; exit 1)
BUILT_SOURCES += mpn/jacobitab.h

gen-jacobitab$(EXEEXT_FOR_BUILD): gen-jacobitab$(U_FOR_BUILD).c
@@ -402,8 +406,8 @@ DISTCLEANFILES += gen-jacobitab$(EXEEXT_FOR_BUILD)
EXTRA_DIST += gen-jacobitab.c


-mpn/perfsqr.h: gen-psqr$(EXEEXT_FOR_BUILD)
- ./gen-psqr $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1)
+mpn/perfsqr.h: $(HOST_TOOLS_PREFIX)/gen-psqr$(EXEEXT_FOR_BUILD)
+ $(HOST_TOOLS_PREFIX)/gen-psqr $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1)
BUILT_SOURCES += mpn/perfsqr.h

gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c bootstrap.c
diff --git a/acinclude.m4 b/acinclude.m4
index 86175ce..82b7ea1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -3833,6 +3833,7 @@ if AC_TRY_EVAL(gmp_compile); then
if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&AC_FD_CC 2>&1; then
cc_for_build_works=yes
fi
+ cc_for_build_works=yes # forced
fi
rm -f conftest* a.out b.out a.exe a_out.exe
AC_MSG_RESULT($cc_for_build_works)
12 changes: 6 additions & 6 deletions ports/gmp/msvc_symbol.patch
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
diff --git a/configure.ac b/configure.ac
index cafdb3c71..bd92bc4bb 100644
index cafdb3c..3c3e3c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2703,8 +2703,8 @@ Use "--disable-static --enable-shared" to build just a DLL.])
@@ -2702,9 +2702,7 @@ Use "--disable-static --enable-shared" to build just a DLL.])
# __isascii, but for some reason not the plain isascii.
#
if test "$enable_shared" = yes; then
GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined -Wl,--export-all-symbols"
- GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined -Wl,--export-all-symbols"
- LIBGMP_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmp-3.dll.def"
- LIBGMPXX_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmpxx-3.dll.def"
+ #LIBGMP_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmp-3.dll.def"
+ #LIBGMPXX_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmpxx-3.dll.def"
+ GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined"
Comment on lines 8 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm does the symbol export still work without these ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this with mingw-dynamic: The import libs are present and not empty, only smaller (in particular the C++ lib).
AFAIU from the headers, there should be enough export declarations for the public API. Only the tests, fuzzers etc. might need some symbols which are not covered. But vcpkg doesn't build them.
And the package even takes care of putting the right definitions into the header for DLL import. Maybe this is why they don't allow simultaneous shared+static for Windows.

LIBGMP_DLL=1
fi
;;
diff --git a/gmp-h.in b/gmp-h.in
index 3d449d427..18a03b753 100644
index 3d449d4..18a03b7 100644
--- a/gmp-h.in
+++ b/gmp-h.in
@@ -398,7 +398,7 @@ typedef __mpq_struct *mpq_ptr;
Expand Down
Loading