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.
targ_defvec=mips_elf32_be_vec
targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
;;
+ mips64*el-*-linux*-gnuabi64)
+ targ_defvec=mips_elf64_trad_le_vec
+ targ_selvecs="mips_elf64_trad_be_vec mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec"
+ want64=true
+ ;;
mips64*el-*-linux*)
targ_defvec=mips_elf32_ntrad_le_vec
targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec"
;;
+ mips64*-*-linux*-gnuabi64)
+ targ_defvec=mips_elf64_trad_be_vec
+ targ_selvecs="mips_elf64_trad_le_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec"
+ want64=true
+ ;;
mips64*-*-linux*)
targ_defvec=mips_elf32_ntrad_be_vec
targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
if [istarget *el-*-*] {
set abi_asflags(o32) -32
set abi_ldflags(o32) -melf32ltsmip
- set abi_asflags(n64) "-march=from-abi -64"
- set abi_ldflags(n64) -melf64ltsmip
+ if [istarget *-*-*-gnuabi64] {
+ set abi_asflags(n32) "-march=from-abi -n32"
+ set abi_ldflags(n32) -melf32ltsmipn32
+ } else {
+ set abi_asflags(n64) "-march=from-abi -64"
+ set abi_ldflags(n64) -melf64ltsmip
+ }
} else {
set abi_asflags(o32) -32
set abi_ldflags(o32) -melf32btsmip
- set abi_asflags(n64) "-march=from-abi -64"
- set abi_ldflags(n64) -melf64btsmip
+ if [istarget *-*-*-gnuabi64] {
+ set abi_asflags(n32) "-march=from-abi -n32"
+ set abi_ldflags(n32) -melf32btsmipn32
+ } else {
+ set abi_asflags(n64) "-march=from-abi -64"
+ set abi_ldflags(n64) -melf64btsmip
+ }
}
set irixemul 0
} elseif {[istarget *-*-linux*] } {
run_dump_test "strip-9"
run_dump_test "strip-12"
- if { [istarget "mips64*-*-openbsd*"] } {
+ if { [istarget "mips64*-*-openbsd*"] \
+ || [istarget "mips64*-*-*-gnuabi64"] } {
set reloc_format mips64
}
# A relocation type not supported by any target
#source: remove-relocs-01.s
#objcopy: --remove-relocations=.data.relocs.01
#readelf: -r
-#notarget: "mips64*-*-openbsd*"
+#notarget: mips64*-*-openbsd* mips64*-*-*-gnuabi64
Relocation section '\.rela?\.data\.relocs\.02' at offset 0x[0-9a-f]+ contains 3 entries:
.*
#source: remove-relocs-01.s
#objcopy: --remove-relocations=.data.relocs.0\[12\]
#readelf: -r
-#notarget: "mips64*-*-openbsd*"
+#notarget: mips64*-*-openbsd* mips64*-*-*-gnuabi64
Relocation section '\.rela?\.data\.relocs\.03' at offset 0x[0-9a-f]+ contains 3 entries:
.*
#source: remove-relocs-01.s
#objcopy: --remove-section=.rela.data.relocs.01 --remove-section=.rel.data.relocs.01
#readelf: -r
-#notarget: "mips64*-*-openbsd*"
+#notarget: mips64*-*-openbsd* mips64*-*-*-gnuabi64
Relocation section '\.rela?\.data\.relocs\.02' at offset 0x[0-9a-f]+ contains 3 entries:
.*
#source: remove-relocs-01.s
#objcopy: --remove-relocations=.data.relocs.* --remove-relocations=!.data.relocs.02
#readelf: -r
-#notarget: "mips64*-*-openbsd*"
+#notarget: mips64*-*-openbsd* mips64*-*-*-gnuabi64
Relocation section '\.rela?\.data\.relocs\.02' at offset 0x[0-9a-f]+ contains 3 entries:
.*
esac
# Decide which ABI to target by default.
case ${target} in
+ mips64*-openbsd* | mips64*-linux-gnuabi64)
+ mips_default_abi=N64_ABI
+ ;;
mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
| mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
mips_default_abi=N32_ABI
mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
mips_default_abi=O32_ABI
;;
- mips64*-openbsd*)
- mips_default_abi=N64_ABI
- ;;
*)
mips_default_abi=NO_ABI
;;
esac
# Decide which ABI to target by default.
case ${target} in
+ mips64*-openbsd* | mips64*-linux-gnuabi64)
+ mips_default_abi=N64_ABI
+ ;;
mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* \
| mips64*-kfreebsd*-gnu | mips64*-ps2-elf*)
mips_default_abi=N32_ABI
mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu)
mips_default_abi=O32_ABI
;;
- mips64*-openbsd*)
- mips_default_abi=N64_ABI
- ;;
*)
mips_default_abi=NO_ABI
;;
#name: Compact EH EB #7 with personality id and fallback FDE
#source: compact-eh-7.s
#as: -EB -mno-pdr
-#notarget: mips64*-*-openbsd*
+#notarget: mips64*-*-openbsd* mips64*-*-*-gnuabi64
.*: file format.*
#name: Compact EH EL #7 with personality id and fallback FDE
#source: compact-eh-7.s
#as: -EL -mno-pdr
-#notarget: mips64*-*-openbsd*
+#notarget: mips64*-*-openbsd* mips64*-*-*-gnuabi64
.*: file format.*
;;
mips*-*-windiss) targ_emul=elf32mipswindiss
;;
+mips64*el-*-linux-gnuabi64)
+ targ_emul=elf64ltsmip
+ targ_extra_emuls="elf64btsmip elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
targ_extra_libpath=$targ_extra_emuls
;;
+mips64*-*-linux-gnuabi64)
+ targ_emul=elf64btsmip
+ targ_extra_emuls="elf64ltsmip elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
mips64*-*-linux-*) targ_emul=elf32btsmipn32
targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
targ_extra_libpath=$targ_extra_emuls
#as: -mpdr
#ld: -r
#readelf: -hA
-#notarget: mips64*-*-openbsd*
+#notarget: mips64*-*-openbsd* mips64*-*-*-gnuabi64
ELF Header:
Magic: .*
#as: -EB
#readelf: -x .eh_frame_hdr
#ld: -EB -e main
-#
+#notarget: mips64*-*-*-gnuabi64
Hex dump of section \'\.eh_frame_hdr\':
if [istarget *el-*-*] {
set abi_asflags(o32) -32
set abi_ldflags(o32) -melf32ltsmip
- set abi_asflags(n64) "-march=from-abi -64"
- set abi_ldflags(n64) -melf64ltsmip
+ if [istarget *-*-*-gnuabi64] {
+ set abi_asflags(n32) "-march=from-abi -n32"
+ set abi_ldflags(n32) -melf32ltsmipn32
+ } else {
+ set abi_asflags(n64) "-march=from-abi -64"
+ set abi_ldflags(n64) -melf64ltsmip
+ }
} else {
set abi_asflags(o32) -32
set abi_ldflags(o32) -melf32btsmip
- set abi_asflags(n64) "-march=from-abi -64"
- set abi_ldflags(n64) -melf64btsmip
+ if [istarget *-*-*-gnuabi64] {
+ set abi_asflags(n32) "-march=from-abi -n32"
+ set abi_ldflags(n32) -melf32btsmipn32
+ } else {
+ set abi_asflags(n64) "-march=from-abi -64"
+ set abi_ldflags(n64) -melf64btsmip
+ }
}
set irixemul 0
} elseif {[istarget *-*-linux*] } {
run_dump_test "got-page-1"
run_dump_test_n32 "got-page-2"
run_dump_test_n64 "dyn-sec64" noarch
- run_dump_test "got-page-3"
+ run_dump_test_o32 "got-page-3"
+ run_dump_test_n32 "got-page-3" [list [list name (n32)]]
if $has_abi(o32) {
run_ld_link_tests [subst {
{"GOT page 4 (one file)"
# triplets, and S+core targets using an extra R_SCORE_NONE
# relocation, so adjust for that.
switch -glob $target_triplet {
- "mips64*-*-openbsd*" {
+ "mips64*-*-openbsd*" -
+ "mips64*-*-*-gnuabi64" {
set none_count 6
set reloc_count 4
}