t-constants FAILs with GMP 6.2.1 on aarch64

Richard Biener rguenther at suse.de
Wed Dec 9 07:21:23 UTC 2020


See https://bugzilla.opensuse.org/show_bug.cgi?id=1179751 where
Guillaume tracked this down to a change from GMP 6.2.0 to GMP 6.2.1.

The issue shows up as

Starting program: /home/abuild/rpmbuild/BUILD/gmp-6.2.1/tests/t-constants 
Missing separate debuginfos, use: zypper install 
glibc-debuginfo-2.32-3.3.aarch64
PP_INVERTED == 21cfe6cfc938b36b, but pp_inverted_calc == 20f8c8b59d4cb9bc

Reverting

diff --git a/mpn/arm64/invert_limb.asm b/mpn/arm64/invert_limb.asm
index a94b0e961..6a99bf002 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
+       LEA_HI( x1, approx_tab)
        and     x2, x2, #0x1fe
-       add     x1, x1, :lo12:approx_tab
+       LEA_LO( x1, approx_tab)
        ldrh    w3, [x1,x2]
        lsr     x4, x0, #24
        add     x4, x4, #1

fixes the issue.  Disassembly of the bogus libgmp routine is 
(via objdump)

000000000005d188 <__gmpn_invert_limb>:
   5d188:       d376fc02        lsr     x2, x0, #54
   5d18c:       d0000181        adrp    x1, 8f000 
<toom_eval_pm2exp.c.32b029f3+0x1d9>
   5d190:       927f1c42        and     x2, x2, #0x1fe
   5d194:       f9475c21        ldr     x1, [x1, #3768]
   5d198:       78626823        ldrh    w3, [x1, x2]
   5d19c:       d358fc04        lsr     x4, x0, #24
   5d1a0:       91000484        add     x4, x4, #0x1

relocations of the object are

Relocation section '.rela.text' at offset 0x558 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name + 
Addend
000000000004  000100000137 R_AARCH64_ADR_GOT 0000000000000000 .text + 7c
00000000000c  000100000138 R_AARCH64_LD64_GO 0000000000000000 .text + 7c

not sure what goes wrong, but the approx_tab data ends up in the .text
section (so going via the GOT is even unnecessary - but I see the .asm
file uses .DATA which hints at that it should go to .data or .rodata).

Richard.

-- 
Richard Biener <rguenther at suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)


More information about the gmp-devel mailing list