[vlc-commits] contrib: gmp: add patches to fix arm64 assembly

Marvin Scholz git at videolan.org
Fri Aug 14 16:02:54 CEST 2020


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Aug  5 22:43:42 2020 +0200| [ca866cb94ca423993f89b6737ffc61d1448dde30] | committer: Marvin Scholz

contrib: gmp: add patches to fix arm64 assembly

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ca866cb94ca423993f89b6737ffc61d1448dde30
---

 ...GSYM_PREFIX-to-function-calls-in-assembly.patch | 32 ++++++++++++++++++++++
 ...ange-adrp-add-relocations-to-darwin-style.patch | 28 +++++++++++++++++++
 contrib/src/gmp/rules.mak                          |  4 +++
 3 files changed, 64 insertions(+)

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 0000000000..5be34d1222
--- /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 0000000000..007162bf0c
--- /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 8d5d03ffbe..de2ce20175 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)



More information about the vlc-commits mailing list