FX <fxcoud...@gmail.com> writes:

  If I don’t disable assembly, the compiler’s not happy with the asm code:

  libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP
  -I.. -DOPERATION_dcpi1_bdiv_q -O2 -pedantic -march=armv8-a -c
  dcpi1_bdiv_q.c -o dcpi1_bdiv_q.o >/dev/null 2>&1
  tmp-bdiv_q_1.s:75:2: error: ADR/ADRP relocations must be GOT relative
   adrp x7, :got:__gmp_binvert_limb_table
   ^
  tmp-bdiv_q_1.s:75:2: error: unknown AArch64 fixup kind!
   adrp x7, :got:__gmp_binvert_limb_table
   ^
  tmp-bdiv_q_1.s:77:2: error: unknown AArch64 fixup kind!
   ldr x7, [x7, #:got_lo12:__gmp_binvert_limb_table]
   ^

  which happens in both tmp-bdiv_q_1.s and tmp-invert_limb.s

Could you please try again with the attached patch, doing just a plain
.../configure && make && make check?

diff -Nrc2 gmp-main.9240f425c585/configure.ac gmp-main/configure.ac
*** gmp-main.9240f425c585/configure.ac	Thu Jun 18 18:39:48 2020
--- gmp-main/configure.ac	Fri Jul  3 10:37:59 2020
***************
*** 3700,3703 ****
--- 3700,3711 ----
          32)
  	  GMP_INCLUDE_MPN(arm/arm-defs.m4) ;;
+         64)
+ 	  case $host in
+ 	    *-*-darwin*)
+ 	      GMP_INCLUDE_MPN(arm64/darwin.m4) ;;
+ 	    *)
+ 	      GMP_INCLUDE_MPN(arm64/arm64-defs.m4) ;;
+           esac
+ 	  ;;
        esac
        ;;
diff -Nrc2 gmp-main.9240f425c585/mpn/arm64/arm64-defs.m4 gmp-main/mpn/arm64/arm64-defs.m4
*** gmp-main.9240f425c585/mpn/arm64/arm64-defs.m4	Thu Jan  1 01:00:00 1970
--- gmp-main/mpn/arm64/arm64-defs.m4	Fri Jul  3 10:37:59 2020
***************
*** 0 ****
--- 1,47 ----
+ divert(-1)
+ 
+ dnl  m4 macros for ARM64 ELF 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
+ 
+ ifdef(`PIC',`dnl
+ define(`LEA_HI', `adrp	$1, :got:$2')dnl
+ define(`LEA_LO', `ldr	$1, [$1, #:got_lo12:$2]')dnl
+ ',`dnl
+ define(`LEA_HI', `adrp	$1, $2')dnl
+ define(`LEA_LO', `add	$1, $1, :lo12:$2')dnl
+ ')dnl
+ 
+ divert
diff -Nrc2 gmp-main.9240f425c585/mpn/arm64/bdiv_q_1.asm gmp-main/mpn/arm64/bdiv_q_1.asm
*** gmp-main.9240f425c585/mpn/arm64/bdiv_q_1.asm	Thu Jun 18 18:39:48 2020
--- gmp-main/mpn/arm64/bdiv_q_1.asm	Fri Jul  3 10:37:59 2020
***************
*** 62,74 ****
  	lsr	d, d, cnt
  
! ifdef(`PIC',`
! 	adrp	x7, :got:__gmp_binvert_limb_table
  	ubfx	x6, d, 1, 7
! 	ldr	x7, [x7, #:got_lo12:__gmp_binvert_limb_table]
! ',`
! 	adrp	x7, __gmp_binvert_limb_table
! 	ubfx	x6, d, 1, 7
! 	add	x7, x7, :lo12:__gmp_binvert_limb_table
! ')
  	ldrb	w6, [x7, x6]
  	ubfiz	x7, x6, 1, 8
--- 62,68 ----
  	lsr	d, d, cnt
  
! 	LEA_HI(	x7, mpn_invert_limb_table)
  	ubfx	x6, d, 1, 7
! 	LEA_LO(	x7, mpn_invert_limb_table)
  	ldrb	w6, [x7, x6]
  	ubfiz	x7, x6, 1, 8
diff -Nrc2 gmp-main.9240f425c585/mpn/arm64/darwin.m4 gmp-main/mpn/arm64/darwin.m4
*** gmp-main.9240f425c585/mpn/arm64/darwin.m4	Thu Jan  1 01:00:00 1970
--- gmp-main/mpn/arm64/darwin.m4	Fri Jul  3 10:37:59 2020
***************
*** 0 ****
--- 1,42 ----
+ divert(-1)
+ 
+ dnl  m4 macros for ARM64 Darwin 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
+ 
+ define(`LEA_HI',`adrp	$1, $2@GOTPAGE')dnl
+ define(`LEA_LO',`ldr	$1, [$1, $2@GOTPAGEOFF]')dnl
+ 
+ divert
diff -Nrc2 gmp-main.9240f425c585/mpn/arm64/invert_limb.asm gmp-main/mpn/arm64/invert_limb.asm
*** gmp-main.9240f425c585/mpn/arm64/invert_limb.asm	Thu Jun 18 18:39:48 2020
--- gmp-main/mpn/arm64/invert_limb.asm	Fri Jul  3 10:37:59 2020
***************
*** 42,48 ****
  PROLOGUE(mpn_invert_limb)
  	lsr	x2, x0, #54
! 	adrp	x1, approx_tab
  	and	x2, x2, #0x1fe
! 	add	x1, x1, :lo12:approx_tab
  	ldrh	w3, [x1,x2]
  	lsr	x4, x0, #24
--- 42,48 ----
  PROLOGUE(mpn_invert_limb)
  	lsr	x2, x0, #54
! 	LEA_HI(	x1, approx_tab)
  	and	x2, x2, #0x1fe
! 	LEA_LO(	x1, approx_tab)
  	ldrh	w3, [x1,x2]
  	lsr	x4, x0, #24

-- 
Torbjörn
Please encrypt, key id 0xC8601622
_______________________________________________
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to