MIPS: Support `-gnuabi64' target triplet suffix for 64-bit Linux targets
authorYunQiang Su <yunqiang.su@cipunited.com>
Fri, 28 Jul 2023 05:00:37 +0000 (06:00 +0100)
committerMaciej W. Rozycki <macro@orcam.me.uk>
Fri, 28 Jul 2023 05:00:37 +0000 (06:00 +0100)
commit29c108c9610640439daa5244a573348b7c47d994
tree5065cd49cff1683cb17c80c66de8923a4b6eb13e
parent316be2b229f5bd07ebef48fd1d7b8cb103e4d815
MIPS: Support `-gnuabi64' target triplet suffix for 64-bit Linux targets

Make the n64 ABI the default for 64-bit Linux targets specified with
`-gnuabi64' suffix included in the target triplet, for configurations
such as the Debian mips64el and mips64r6el ports.  Adjust testsuite
configuration accordingly.

There are the following regressions with the new target triplet:

mips64-linux-gnuabi64  +FAIL: readelf -S bintest
mips64-linux-gnuabi64  +FAIL: MIPS reloc estimation 1
mips64el-linux-gnuabi64  +FAIL: readelf -S bintest
mips64el-linux-gnuabi64  +FAIL: MIPS reloc estimation 1

The `readelf' issue comes from a difference in section headers produced
that the `binutils/testsuite/binutils-all/readelf.s-64' pattern template
does not match.  While there has been a precedent it does not appear to
me that there is a clear advantage from adding more and more variations
to the template rather than forking the existing template into multiple
ones for a more exact match.  So this is best deferred to a separate
discussion.

The MIPS reloc estimation issue is an actual bug in `objdump', which
discards a number of trailing entries from output here for n64 composed
relocations:

DYNAMIC RELOCATION RECORDS
OFFSET           TYPE              VALUE
0000000000000000 R_MIPS_NONE       *ABS*
0000000000000000 R_MIPS_NONE       *ABS*

and consequently `ld/testsuite/ld-mips-elf/reloc-estimate-1.d' does not
match even though ELF output produced is correct according to `readelf':

Relocation section '.rel.dyn' at offset 0x10400 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name
000000000000  000000000000 R_MIPS_NONE
                    Type2: R_MIPS_NONE
                    Type3: R_MIPS_NONE
000000010000  000300001203 R_MIPS_REL32      0000000000010010 foo@@V2
                    Type2: R_MIPS_64
                    Type3: R_MIPS_NONE

As a genuine bug this has to be handled separately.

Co-Authored by: Maciej W. Rozycki <macro@orcam.me.uk>

bfd/
* config.bfd: Add `mips64*el-*-linux*-gnuabi64' and
`mips64*-*-linux*-gnuabi64' targets.

binutils/
* testsuite/binutils-all/mips/mips.exp: Handle `*-*-*-gnuabi64'
targets.
* testsuite/binutils-all/objcopy.exp: Handle
`mips64*-*-*-gnuabi64' targets.
* testsuite/binutils-all/remove-relocs-01.d: Likewise.
* testsuite/binutils-all/remove-relocs-04.d: Likewise.
* testsuite/binutils-all/remove-relocs-05.d: Likewise.
* testsuite/binutils-all/remove-relocs-06.d: Likewise.

gas/
* configure.ac: Handle `mips64*-linux-gnuabi64' targets.
* configure: Regenerate.
* testsuite/gas/mips/compact-eh-eb-7.d: Handle
`mips64*-*-*-gnuabi64' targets.
* testsuite/gas/mips/compact-eh-el-7.d: Likewise.

ld/
* configure.tgt: Add `mips64*el-*-linux-gnuabi64' and
`mips64*-*-linux-gnuabi64' targets.
* testsuite/ld-undefined/undefined.exp: Handle
`mips64*-*-*-gnuabi64' targets.
* testsuite/ld-mips-elf/attr-gnu-4-10.d: Likewise.
* testsuite/ld-mips-elf/compact-eh6.d: Likewise.
* testsuite/ld-mips-elf/mips-elf.exp: Handle `*-*-*-gnuabi64'
targets.
16 files changed:
bfd/config.bfd
binutils/testsuite/binutils-all/mips/mips.exp
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/remove-relocs-01.d
binutils/testsuite/binutils-all/remove-relocs-04.d
binutils/testsuite/binutils-all/remove-relocs-05.d
binutils/testsuite/binutils-all/remove-relocs-06.d
gas/configure
gas/configure.ac
gas/testsuite/gas/mips/compact-eh-eb-7.d
gas/testsuite/gas/mips/compact-eh-el-7.d
ld/configure.tgt
ld/testsuite/ld-mips-elf/attr-gnu-4-10.d
ld/testsuite/ld-mips-elf/compact-eh6.d
ld/testsuite/ld-mips-elf/mips-elf.exp
ld/testsuite/ld-undefined/undefined.exp