[vlc-devel] [PATCH v2 4/7] contrib: gmp: add patches to fix arm64 assembly
Marvin Scholz
epirat07 at gmail.com
Thu Aug 6 00:07:22 CEST 2020
---
...PREFIX-to-function-calls-in-assembly.patch | 32 +++++++++++++++++++
...adrp-add-relocations-to-darwin-style.patch | 28 ++++++++++++++++
contrib/src/gmp/rules.mak | 4 +++
3 files changed, 64 insertions(+)
create mode 100644 contrib/src/gmp/arm64-Add-GSYM_PREFIX-to-function-calls-in-assembly.patch
create mode 100644 contrib/src/gmp/arm64-Change-adrp-add-relocations-to-darwin-style.patch
diff --git a/contrib/src/gmp/arm64-Add-GSYM_PREFIX-to-function-calls-in-assembly.patch b/contrib/src/gmp/arm64-Add-GSYM_PREFIX-to-function-calls-in-assembly.patch
new file mode 100644
index 00000000000..5be34d12225
--- /dev/null
+++ b/contrib/src/gmp/arm64-Add-GSYM_PREFIX-to-function-calls-in-assembly.patch
@@ -0,0 +1,32 @@
+From 2612d34f216ec3e60b3f1b1165dc9935e4c2e2a5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Tue, 4 Aug 2020 13:45:54 +0300
+Subject: [PATCH 3/4] arm64: Add GSYM_PREFIX to function calls in assembly
+
+---
+ mpn/arm64/gcd_1.asm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mpn/arm64/gcd_1.asm b/mpn/arm64/gcd_1.asm
+index bc03d80dd..9c267cb07 100644
+--- a/mpn/arm64/gcd_1.asm
++++ b/mpn/arm64/gcd_1.asm
+@@ -82,13 +82,13 @@ C Both U and V are single limbs, reduce with bmod if u0 >> v0.
+ b.hi L(red1)
+
+ L(bmod):mov x3, #0 C carry argument
+- bl mpn_modexact_1c_odd
++ bl GSYM_PREFIX`'mpn_modexact_1c_odd
+ b L(red0)
+
+ L(nby1):cmp n, #BMOD_1_TO_MOD_1_THRESHOLD
+ b.lo L(bmod)
+
+- bl mpn_mod_1
++ bl GSYM_PREFIX`'mpn_mod_1
+
+ L(red0):mov x3, x0
+ L(red1):cmp x3, #0
+--
+2.24.3 (Apple Git-128)
+
diff --git a/contrib/src/gmp/arm64-Change-adrp-add-relocations-to-darwin-style.patch b/contrib/src/gmp/arm64-Change-adrp-add-relocations-to-darwin-style.patch
new file mode 100644
index 00000000000..007162bf0c3
--- /dev/null
+++ b/contrib/src/gmp/arm64-Change-adrp-add-relocations-to-darwin-style.patch
@@ -0,0 +1,28 @@
+From 056fbee0d76491b5f19f5741e9bf9178c03de7dc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Tue, 4 Aug 2020 13:12:49 +0300
+Subject: [PATCH 2/4] arm64: Change adrp/add relocations to darwin style
+
+---
+ mpn/arm64/invert_limb.asm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mpn/arm64/invert_limb.asm b/mpn/arm64/invert_limb.asm
+index a94b0e961..bb876d97c 100644
+--- a/mpn/arm64/invert_limb.asm
++++ b/mpn/arm64/invert_limb.asm
+@@ -41,9 +41,9 @@ C Compiler generated, mildly edited. Could surely be further optimised.
+ ASM_START()
+ PROLOGUE(mpn_invert_limb)
+ lsr x2, x0, #54
+- adrp x1, approx_tab
++ adrp x1, approx_tab at PAGE
+ and x2, x2, #0x1fe
+- add x1, x1, :lo12:approx_tab
++ add x1, x1, approx_tab at PAGEOFF
+ ldrh w3, [x1,x2]
+ lsr x4, x0, #24
+ add x4, x4, #1
+--
+2.24.3 (Apple Git-128)
+
diff --git a/contrib/src/gmp/rules.mak b/contrib/src/gmp/rules.mak
index 8d5d03ffbe3..de2ce201750 100644
--- a/contrib/src/gmp/rules.mak
+++ b/contrib/src/gmp/rules.mak
@@ -36,6 +36,10 @@ gmp: gmp-$(GMP_VERSION).tar.bz2 .sum-gmp
$(APPLY) $(SRC)/gmp/win-arm64.patch
$(APPLY) $(SRC)/gmp/gmp-fix-asm-detection.patch
$(APPLY) $(SRC)/gmp/tests-mpn-t-sqrlo.c-Initialise-scratch-area.patch
+ $(APPLY) $(SRC)/gmp/arm64-Add-GSYM_PREFIX-to-function-calls-in-assembly.patch
+ifdef HAVE_DARWIN_OS
+ $(APPLY) $(SRC)/gmp/arm64-Change-adrp-add-relocations-to-darwin-style.patch
+endif
# do not try the cross compiler to detect the build compiler
cd $(UNPACK_DIR) && sed -i.orig 's/"$$CC" "$$CC $$CFLAGS $$CPPFLAGS" cc gcc c89 c99/cc gcc c89 c99/' acinclude.m4
$(MOVE)
--
2.24.3 (Apple Git-128)
More information about the vlc-devel
mailing list