forked from Imagelibrary/binutils-gdb
MIPS/BFD: For n64 hold the number of internal relocs in `->reloc_count'
Revert parts of commit fee24f1c5b ("objdump improvements for mips
elf64"), <https://sourceware.org/ml/binutils/2003-03/msg00108.html>, and
make the `->reloc_count' member of `struct bfd_section' hold the actual
number of internal relocations stored in its `->relocation' vector. To
do so adjust `mips_elf64_slurp_one_reloc_table' to set `->reloc_count'
to the actual number of internal relocations retrieved and discard
`mips_elf64_canonicalize_reloc', `mips_elf64_canonicalize_dynamic_reloc'
and their corresponding target macros. Contrary to the description of
`mips_elf64_slurp_one_reloc_table', adjusted appropriately, this makes
generic relocation processing code happy and satisfies the "merge notes
section" binutils test case.
Add extra binutils test cases to expand the coverage of the generic
"merge notes section" test case, now passing with the n64 ABI, across
the MIPS o32, n32 and n64 ABIs regardless of the default ABI selected in
target configuration, and also to verify correctness of the relocations
produced. Conversely, do not provide any additional test cases for the
original issue addressed with the commit referred:
- objdump would display only 1/3 of the total number of relocations,
because it used the external relocation count, but each external
relocation is brought in as 3 internal relocations.
as n64 ABI relocation processing with `objdump -r' and `objdump -R' is
already widely covered across the GAS and LD test suites.
bfd/
* elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
and function.
(mips_elf64_canonicalize_dynamic_reloc): Likewise.
(mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
actual number of internal relocations retrieved. Adjust
function description.
(bfd_elf64_canonicalize_reloc): Remove macro.
(bfd_elf64_canonicalize_dynamic_reloc): Likewise.
binutils/
* testsuite/binutils-all/mips/mips-note-2.d: New test.
* testsuite/binutils-all/mips/mips-note-2r.d: New test.
* testsuite/binutils-all/mips/mips-note-2-n32.d: New test.
* testsuite/binutils-all/mips/mips-note-2-n64.d: New test.
* testsuite/binutils-all/mips/mips-note-2r-n32.d: New test.
* testsuite/binutils-all/mips/mips-note-2r-n64.d: New test.
* testsuite/binutils-all/mips/mips.exp: Define `has_newabi'.
Run the new tests.
This commit is contained in:
7
binutils/testsuite/binutils-all/mips/mips-note-2-n32.d
Normal file
7
binutils/testsuite/binutils-all/mips/mips-note-2-n32.d
Normal file
@@ -0,0 +1,7 @@
|
||||
#PROG: objcopy
|
||||
#readelf: --notes --wide
|
||||
#objcopy: --merge-notes
|
||||
#name: MIPS merge notes section (n32)
|
||||
#as: -n32 -mips3
|
||||
#source: ../note-2-32.s
|
||||
#dump: ../note-2-32.d
|
||||
7
binutils/testsuite/binutils-all/mips/mips-note-2-n64.d
Normal file
7
binutils/testsuite/binutils-all/mips/mips-note-2-n64.d
Normal file
@@ -0,0 +1,7 @@
|
||||
#PROG: objcopy
|
||||
#readelf: --notes --wide
|
||||
#objcopy: --merge-notes
|
||||
#name: MIPS merge notes section (n64)
|
||||
#as: -64 -mips3
|
||||
#source: ../note-2-64.s
|
||||
#dump: ../note-2-64.d
|
||||
7
binutils/testsuite/binutils-all/mips/mips-note-2.d
Normal file
7
binutils/testsuite/binutils-all/mips/mips-note-2.d
Normal file
@@ -0,0 +1,7 @@
|
||||
#PROG: objcopy
|
||||
#readelf: --notes --wide
|
||||
#objcopy: --merge-notes
|
||||
#name: MIPS merge notes section (o32)
|
||||
#as: -32
|
||||
#source: ../note-2-32.s
|
||||
#dump: ../note-2-32.d
|
||||
11
binutils/testsuite/binutils-all/mips/mips-note-2r-n32.d
Normal file
11
binutils/testsuite/binutils-all/mips/mips-note-2r-n32.d
Normal file
@@ -0,0 +1,11 @@
|
||||
#PROG: objcopy
|
||||
#readelf: --relocs
|
||||
#objcopy: --merge-notes
|
||||
#name: MIPS merge notes section relocations (n32)
|
||||
#as: -n32 -mips3
|
||||
#source: ../note-2-32.s
|
||||
|
||||
Relocation section '\.rela\.gnu\.build\.attributes' at offset .* contains 2 entries:
|
||||
Offset Info Type Sym\.Value Sym\. Name \+ Addend
|
||||
00000010 ......02 R_MIPS_32 00000100 note1\.s \+ 0
|
||||
0000006c ......02 R_MIPS_32 00000104 note2\.s \+ 0
|
||||
15
binutils/testsuite/binutils-all/mips/mips-note-2r-n64.d
Normal file
15
binutils/testsuite/binutils-all/mips/mips-note-2r-n64.d
Normal file
@@ -0,0 +1,15 @@
|
||||
#PROG: objcopy
|
||||
#readelf: --relocs
|
||||
#objcopy: --merge-notes
|
||||
#name: MIPS merge notes section relocations (n64)
|
||||
#as: -64 -mips3
|
||||
#source: ../note-2-64.s
|
||||
|
||||
Relocation section '\.rela\.gnu\.build\.attributes' at offset .* contains 2 entries:
|
||||
Offset Info Type Sym\. Value Sym\. Name \+ Addend
|
||||
000000000010 ....00000012 R_MIPS_64 0000000000000100 note1\.s \+ 0
|
||||
Type2: R_MIPS_NONE
|
||||
Type3: R_MIPS_NONE
|
||||
000000000070 ....00000012 R_MIPS_64 0000000000000104 note2\.s \+ 0
|
||||
Type2: R_MIPS_NONE
|
||||
Type3: R_MIPS_NONE
|
||||
11
binutils/testsuite/binutils-all/mips/mips-note-2r.d
Normal file
11
binutils/testsuite/binutils-all/mips/mips-note-2r.d
Normal file
@@ -0,0 +1,11 @@
|
||||
#PROG: objcopy
|
||||
#readelf: --relocs
|
||||
#objcopy: --merge-notes
|
||||
#name: MIPS merge notes section relocations (o32)
|
||||
#as: -32
|
||||
#source: ../note-2-32.s
|
||||
|
||||
Relocation section '\.rel\.gnu\.build\.attributes' at offset .* contains 2 entries:
|
||||
Offset Info Type Sym\.Value Sym\. Name
|
||||
00000010 ......02 R_MIPS_32 00000100 note1\.s
|
||||
0000006c ......02 R_MIPS_32 00000104 note2\.s
|
||||
@@ -27,6 +27,12 @@ if [is_remote host] {
|
||||
set copyfile tmpdir/copy
|
||||
}
|
||||
|
||||
set has_newabi [expr [istarget *-*-irix6*] \
|
||||
|| [istarget mips*-*-linux*] \
|
||||
|| [istarget mips*-sde-elf*] \
|
||||
|| [istarget mips*-mti-elf*] \
|
||||
|| [istarget mips*-img-elf*]]
|
||||
|
||||
run_dump_test "mips-ase-1"
|
||||
run_dump_test "mips-ase-2"
|
||||
run_dump_test "mips-ase-3"
|
||||
@@ -41,3 +47,12 @@ run_dump_test "mips16-extend-insn"
|
||||
run_dump_test "mips16e2-extend-insn"
|
||||
run_dump_test "mips16-alias"
|
||||
run_dump_test "mips16-noalias"
|
||||
|
||||
run_dump_test "mips-note-2"
|
||||
run_dump_test "mips-note-2r"
|
||||
if $has_newabi {
|
||||
run_dump_test "mips-note-2-n32"
|
||||
run_dump_test "mips-note-2-n64"
|
||||
run_dump_test "mips-note-2r-n32"
|
||||
run_dump_test "mips-note-2r-n64"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user