Browse Source
Respect any ASE flags recorded in ELF file structures for the purpose of selecting instructions to be disassembled, preventing code from being hex-dumped even though having been clearly indicated as valid at the assembly time. Use date from the MIPS ABI flags structure if present, and otherwise there may be an MDMX ASE flag set in the ELF file header. For backwards compatibility only set extra flags and do not clear any, preserving all previously set by the architecture selected to be disassembled for. include/ * elf/mips.h (Elf_Internal_ABIFlags_v0): Also declare struct typedef as `elf_internal_abiflags_v0'. bfd/ * bfd-in.h (elf_internal_abiflags_v0): New struct declaration. (bfd_mips_elf_get_abiflags): New prototype. * elfxx-mips.c (bfd_mips_elf_get_abiflags): New function. * bfd-in2.h: Regenerate. opcodes/ * mips-dis.c (mips_convert_abiflags_ases): New function. (set_default_mips_dis_options): Also infer ASE flags from ELF file structures. binutils/ * testsuite/binutils-all/mips/mips-ase-1.d: New test. * testsuite/binutils-all/mips/mips-ase-2.d: New test. * testsuite/binutils-all/mips/mips-ase-3.d: New test. * testsuite/binutils-all/mips/mips-ase-1.s: New test source. * testsuite/binutils-all/mips/mips-ase-2.s: New test source. * testsuite/binutils-all/mips/mips.exp: Run the new tests.binutils-2_28-branch
15 changed files with 191 additions and 3 deletions
@ -0,0 +1,29 @@ |
|||
#PROG: objcopy |
|||
#objdump: -dp --prefix-addresses --show-raw-insn |
|||
#name: MIPS ELF file ASE information interpretation for disassembly 1 |
|||
#as: -32 |
|||
|
|||
# Verify that in the absence of its ASE flag MDMX code is not disassembled |
|||
# with MIPS64r2, where MDMX presence is not implied. |
|||
|
|||
.*: +file format .*mips.* |
|||
!private flags = .*mdmx.* |
|||
|
|||
MIPS ABI Flags Version: 0 |
|||
|
|||
ISA: MIPS64r2 |
|||
GPR size: 32 |
|||
CPR1 size: 64 |
|||
CPR2 size: 0 |
|||
FP ABI: Hard float \(32-bit CPU, 64-bit FPU\) |
|||
ISA Extension: None |
|||
ASEs: |
|||
None |
|||
FLAGS 1: .* |
|||
FLAGS 2: .* |
|||
|
|||
Disassembly of section \.text: |
|||
[0-9a-f]+ <[^>]*> 7aa2080b 0x7aa2080b |
|||
[0-9a-f]+ <[^>]*> 46c520c0 add\.ps \$f3,\$f4,\$f5 |
|||
[0-9a-f]+ <[^>]*> 46c83998 addr\.ps \$f6,\$f7,\$f8 |
|||
\.\.\. |
|||
@ -0,0 +1,12 @@ |
|||
.module mips64r2 |
|||
.module fp=64 |
|||
.set mdmx |
|||
.set mips3d |
|||
foo: |
|||
add.qh $v0, $v1, $v2 |
|||
add.ps $f3, $f4, $f5 |
|||
addr.ps $f6, $f7, $f8 |
|||
|
|||
# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... |
|||
.align 4, 0 |
|||
.space 16 |
|||
@ -0,0 +1,29 @@ |
|||
#PROG: objcopy |
|||
#objdump: -dp --prefix-addresses --show-raw-insn |
|||
#name: MIPS ELF file ASE information interpretation for disassembly 2 |
|||
#as: -32 |
|||
|
|||
# Verify that in the presence of its ASE flag MDMX code is disassembled |
|||
# with MIPS64r2, where MDMX presence is not implied. |
|||
|
|||
.*: +file format .*mips.* |
|||
private flags = .[8-f]......: .*mdmx.* |
|||
|
|||
MIPS ABI Flags Version: 0 |
|||
|
|||
ISA: MIPS64r2 |
|||
GPR size: 32 |
|||
CPR1 size: 64 |
|||
CPR2 size: 0 |
|||
FP ABI: Hard float \(32-bit CPU, 64-bit FPU\) |
|||
ISA Extension: None |
|||
ASEs: |
|||
MDMX ASE |
|||
FLAGS 1: .* |
|||
FLAGS 2: .* |
|||
|
|||
Disassembly of section \.text: |
|||
[0-9a-f]+ <[^>]*> 7aa2080b add\.qh \$v0,\$v1,\$v2 |
|||
[0-9a-f]+ <[^>]*> 46c520c0 add\.ps \$f3,\$f4,\$f5 |
|||
[0-9a-f]+ <[^>]*> 46c83998 addr\.ps \$f6,\$f7,\$f8 |
|||
\.\.\. |
|||
@ -0,0 +1,12 @@ |
|||
.module mips64r2 |
|||
.module fp=64 |
|||
.module mdmx |
|||
.set mips3d |
|||
foo: |
|||
add.qh $v0, $v1, $v2 |
|||
add.ps $f3, $f4, $f5 |
|||
addr.ps $f6, $f7, $f8 |
|||
|
|||
# Force some (non-delay-slot) zero bytes, to make 'objdump' print ... |
|||
.align 4, 0 |
|||
.space 16 |
|||
@ -0,0 +1,18 @@ |
|||
#PROG: objcopy |
|||
#objdump: -dp --prefix-addresses --show-raw-insn |
|||
#name: MIPS ELF file ASE information interpretation for disassembly 3 |
|||
#as: -32 |
|||
#objcopy: -R .MIPS.abiflags |
|||
#source: mips-ase-2.s |
|||
|
|||
# Verify that in the presence of its ASE flag MDMX code is disassembled |
|||
# with MIPS64r2, where MDMX presence is not implied. |
|||
|
|||
.*: +file format .*mips.* |
|||
private flags = .[8-f]......: .*mdmx.* |
|||
|
|||
Disassembly of section \.text: |
|||
[0-9a-f]+ <[^>]*> 7aa2080b add\.qh \$v0,\$v1,\$v2 |
|||
[0-9a-f]+ <[^>]*> 46c520c0 add\.ps \$f3,\$f4,\$f5 |
|||
[0-9a-f]+ <[^>]*> 46c83998 addr\.ps \$f6,\$f7,\$f8 |
|||
\.\.\. |
|||
Loading…
Reference in new issue