Skip to contentSkip to conversation

mpir build fixes

PATCH New Thomas Petazzoni 2 participants 6 messages May 8, 2017 – May 9, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover mpir build fixes

Hello,

This new version of the mpir build fixes series now fixes the build for all 49 toolchain configurations, tested with the test-pkg script.

Changes since v1:

- Fix a typo in the mips32r6/mips64r6 that originally made it useless (BR2_mips32r6 was used, while the option is name BR2_mips_32r6)

- Add a patch to fix the powerpc64le build

Best regards,

Thomas

Thomas Petazzoni (4):
mpir: fix build on ARM with old binutils versions
mpir: fix build on ARM Thumb-only platforms
mpir: fix build on mips32r6/mips64r6
mpir: fix build on powerpc64le

 ...rm-udiv.asm-workaround-binutils-bug-14887.patch | 40 ++++++++++++++++++++++
 package/mpir/mpir.mk                               | 16 +++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 package/mpir/0001-mpn-arm-udiv.asm-workaround-binutils-bug-14887.patch
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/4 mpir: fix build on ARM with old binutils versions

Old binutils versions are affected by a bug when the assembly code has whitespace between [ ] signs, causing a build failure of the mpir package with ARM toolchains using such old binutils versions.

This commit fixes that by adding a patch that removes those whitespaces.

Fixes:

- http://autobuild.buildroot.net/results/ec67ffdef74b9a61d0491e71f8cb2f8f0b6daa50/
armv7-ctng-linux-gnueabihf Crosstool-NG toolchain

- http://autobuild.buildroot.net/results/2e4a27af60065db51aca9e69701bc191d24b2209/
armv5-ctng-linux-gnueabi Crosstool-NG toolchain

---
 ...rm-udiv.asm-workaround-binutils-bug-14887.patch | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 package/mpir/0001-mpn-arm-udiv.asm-workaround-binutils-bug-14887.patch
package/mpir/0001-mpn-arm-udiv.asm-workaround-binutils-bug-14887.patch new file +40 -0
new file mode 100644
index 0000000..6a6f467
@@ -0,0 +1,40 @@
+From d858ce52d1971cb4e8500b0ebc0472fdae4686ec Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Sun, 7 May 2017 23:12:04 +0200
+Subject: [PATCH] mpn/arm/udiv.asm: workaround binutils bug #14887
+
+Old binutils versions are affected by bug #14887,
+https://sourceware.org/bugzilla/show_bug.cgi?id=14887, which causes a
+build failure when a register specification is surrounded by
+whitespaces. Removing those whitespaces works around the issue.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ mpn/arm/udiv.asm | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mpn/arm/udiv.asm b/mpn/arm/udiv.asm
+index 25197a6..ed11eb3 100644
+--- a/mpn/arm/udiv.asm
++++ b/mpn/arm/udiv.asm
+@@ -50,7 +50,7 @@ L(oop):	divstep(n1,n0,d)
+ 	teq	r12, #0
+ 	bne	L(oop)
+ 
+-	str	n1, [ rem_ptr ]		C store remainder
++	str	n1, [rem_ptr]		C store remainder
+ 	adc	r0, n0, n0		C quotient: add last carry from divstep
+ 	mov	pc, lr
+ 
+@@ -89,7 +89,7 @@ L(oop2):
+ 	addcs	n0, n0, #1		C adjust quotient
+ 
+ L(_even_divisor):
+-	str	n1, [ rem_ptr ]		C store remainder
++	str	n1, [rem_ptr]		C store remainder
+ 	mov	r0, n0			C quotient
+ 	ldmfd	sp!, { r8, pc }
+ EPILOGUE(mpn_udiv_qrnnd)
+-- 
+2.7.4
+
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/4 mpir: fix build on ARM Thumb-only platforms

In reply to Thomas Petazzoni

The optimized ARM assembly code is not suitable for Thumb-only platforms, so use the generic code in such situations.

Fixes:

http://autobuild.buildroot.net/results/4d7f2a1326f75e11693bdd51ad274079b0dd0ce4/
(ARM Cortex-M4 toolchain)

---
 package/mpir/mpir.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/mpir/mpir.mk +6 -0
index b7f3829..cf17502 100644
@@ -20,4 +20,10 @@ ifeq ($(BR2_MIPS_NABI64),y)
 MPIR_CONF_OPTS += ABI=64
 endif
 
+# The optimized ARM assembly code uses ARM-only (i.e not Thumb1/2
+# compatible) instructions.
+ifeq ($(BR2_arm)$(BR2_armeb):$(BR2_ARM_CPU_HAS_ARM),y:)
+MPIR_CONF_ENV += MPN_PATH="generic"
+endif
+
 $(eval $(autotools-package))
Signature · 1 line
2.7.4
#3 lore raw

PATCH v2 3/4 mpir: fix build on mips32r6/mips64r6

In reply to Thomas Petazzoni

The optimized mips32 and mips64 assembly code is not compatible with mips32r6/mips64r6, so use the generic code of MPIR on such platforms.

Fixes:

- http://autobuild.buildroot.net/results/db2542a2ec3029eda81738a7ae5faeb9ea4aedee/
mips32r6 toolchain

- http://autobuild.buildroot.net/results/50b94e6d0dbc33664c6bfe06f83b211083aa07f7/
mips64r6 toolchain

Cc Vicente Olivert Riera <[email protected]>
---
 package/mpir/mpir.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/mpir/mpir.mk +5 -0
index cf17502..03f21d8 100644
@@ -26,4 +26,9 @@ ifeq ($(BR2_arm)$(BR2_armeb):$(BR2_ARM_CPU_HAS_ARM),y:)
 MPIR_CONF_ENV += MPN_PATH="generic"
 endif
 
+# Optimized mips32/mips64 code not suitable for mips32r6/mips64r6
+ifeq ($(BR2_mips_32r6)$(BR2_mips_64r6),y)
+MPIR_CONF_ENV += MPN_PATH="generic"
+endif
+
 $(eval $(autotools-package))
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 4/4 mpir: fix build on powerpc64le

In reply to Thomas Petazzoni

The optimized powerpc64 code is not compatible with powerpc64le, so use the generic MPIR code on powerpc64le.

Fixes:

http://autobuild.buildroot.net/results/17e523be894b60d7a9b2a3303f02c3fb34816828/

---
 package/mpir/mpir.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/mpir/mpir.mk +5 -0
index 03f21d8..697e838 100644
@@ -31,4 +31,9 @@ ifeq ($(BR2_mips_32r6)$(BR2_mips_64r6),y)
 MPIR_CONF_ENV += MPN_PATH="generic"
 endif
 
+# Optimized powerpc64 code is not suitable for powerpc64le
+ifeq ($(BR2_powerpc64le),y)
+MPIR_CONF_ENV += MPN_PATH="generic"
+endif
+
 $(eval $(autotools-package))
Signature · 1 line
2.7.4
#5 lore raw

v2 cover mpir build fixes

In reply to Thomas Petazzoni
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,
This new version of the mpir build fixes series now fixes the build for all 49 toolchain configurations, tested with the test-pkg script.

Changes since v1:

- Fix a typo in the mips32r6/mips64r6 that originally made it useless (BR2_mips32r6 was used, while the option is name BR2_mips_32r6)

- Add a patch to fix the powerpc64le build

Best regards,

Quoted 7 lines

Thomas

Thomas Petazzoni (4):
mpir: fix build on ARM with old binutils versions
mpir: fix build on ARM Thumb-only platforms
mpir: fix build on mips32r6/mips64r6
mpir: fix build on powerpc64le

Committed all 4, thanks.

Signature · 1 line
Bye, Peter Korsgaard