mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-18 23:03:29 +08:00
c0c468d562
BFD's bfd_get_mach () function returns a bfd specific value representing the architecture of the target which is populated from the Tag_CPU_arch build attribute value of that target. Among other users of that interfacem, objdump which uses it to print the architecture version of the binary being examinated and to decide what instruction is available if run with "-m arm" via its own mapping from bfd_mach_arm_X values to feature bits available. However, both BFD and objdump's most recent known architecture is Armv5TE. When encountering a newer architecture bfd_get_mach will return bfd_mach_arm_unknown. This is unfortunate since objdump uses that value to allow all instructions on all architectures which is already what it does by default, making the "-m arm" trick useless. This patch updates BFD and objdump's knowledge of Arm architecture versions up to the latest Armv8-M Baseline and Mainline, Armv8-R and Armv8.4-A architectures. Since several architecture versions (eg. 8.X-A) share the same Tag_CPU_arch build attribute value and bfd_mach_arm values, the mapping from bfd machine value to feature bits need to return the most featureful feature bits that would yield the given bfd machine value otherwise some instruction would not disassemble under "-m arm" mode. The patch rework that mapping to make this clearer and simplify writing the mapping rules. In particular, for simplicity all FPU instructions are allowed in all cases. Finally, the patch also rewrite the cpu_arch_ver table in GAS to use the TAG_CPU_ARCH_X macros rather than hardcode their value. 2018-07-02 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * archures.c (bfd_mach_arm_5TEJ, bfd_mach_arm_6, bfd_mach_arm_6KZ, bfd_mach_arm_6T2, bfd_mach_arm_6K, bfd_mach_arm_7, bfd_mach_arm_6M, bfd_mach_arm_6SM, bfd_mach_arm_7EM, bfd_mach_arm_8, bfd_mach_arm_8R, bfd_mach_arm_8M_BASE, bfd_mach_arm_8M_MAIN): Define. * bfd-in2.h: Regenerate. * cpu-arm.c (arch_info_struct): Add entries for above new bfd_mach_arm values. * elf32-arm.c (bfd_arm_get_mach_from_attributes): Add Tag_CPU_arch to bfd_mach_arm mapping logic for pre Armv4 and Armv5TEJ and later architectures. Force assert failure for any new Tag_CPU_arch value. gas/ * config/tc-arm.c (cpu_arch_ver): Use symbolic TAG_CPU_ARCH macros rather than hardcode their values. ld/ * arm-dis.c (select_arm_features): Fix typo in heading comment. Allow all FPU features and add mapping from new bfd_mach_arm values to allowed CPU feature bits. opcodes/ * testsuite/ld-arm/tls-descrelax-be8.d: Add architecture version in expected result. * testsuite/ld-arm/tls-descrelax-v7.d: Likewise. * testsuite/ld-arm/tls-longplt-lib.d: Likewise. * testsuite/ld-arm/tls-longplt.d: Likewise.
65 lines
1.9 KiB
Makefile
65 lines
1.9 KiB
Makefile
.*: file format elf32-.*arm
|
|
architecture: armv6t2, flags 0x00000112:
|
|
EXEC_P, HAS_SYMS, D_PAGED
|
|
start address 0x.*
|
|
|
|
Disassembly of section .plt:
|
|
|
|
0000819c <.plt>:
|
|
819c: e52de004 push {lr} ; .*
|
|
81a0: e59fe004 ldr lr, \[pc, #4\] ; .*
|
|
81a4: e08fe00e add lr, pc, lr
|
|
81a8: e5bef008 ldr pc, \[lr, #8\]!
|
|
81ac: 00008100 .word 0x00008100
|
|
81b0: e08e0000 add r0, lr, r0
|
|
81b4: e5901004 ldr r1, \[r0, #4]
|
|
81b8: e12fff11 bx r1
|
|
81bc: e52d2004 push {r2} ; .*
|
|
81c0: e59f200c ldr r2, \[pc, #12\] ; .*
|
|
81c4: e59f100c ldr r1, \[pc, #12\] ; .*
|
|
81c8: e79f2002 ldr r2, \[pc, r2\]
|
|
81cc: e081100f add r1, r1, pc
|
|
81d0: e12fff12 bx r2
|
|
81d4: 000080f4 .word 0x000080f4
|
|
81d8: 000080d8 .word 0x000080d8
|
|
|
|
Disassembly of section .text:
|
|
|
|
000081dc <text>:
|
|
81dc: e59f0004 ldr r0, \[pc, #4\] ; .*
|
|
81e0: fafffff2 blx 81b0 .*
|
|
81e4: e1a00000 nop ; .*
|
|
81e8: 000080d4 .word 0x000080d4
|
|
81ec: 4801 ldr r0, \[pc, #4\] ; .*
|
|
81ee: f7ff efe0 blx 81b0 .*
|
|
81f2: bf00 nop
|
|
81f4: 000080c5 .word 0x000080c5
|
|
|
|
Disassembly of section .foo:
|
|
|
|
04001000 <foo>:
|
|
4001000: e59f0004 ldr r0, \[pc, #4\] ; .*
|
|
4001004: e79f0000 ldr r0, \[pc, r0\]
|
|
4001008: e1a00000 nop ; .*
|
|
400100c: fc00f2b4 .word 0xfc00f2b4
|
|
4001010: e59f0004 ldr r0, \[pc, #4\] ; .*
|
|
4001014: fa000005 blx 4001030 .*
|
|
4001018: e1a00000 nop ; .*
|
|
400101c: fc00f2a0 .word 0xfc00f2a0
|
|
4001020: 4801 ldr r0, \[pc, #4\] ; .*
|
|
4001022: f000 f809 bl 4001038 .*
|
|
4001026: bf00 nop
|
|
4001028: fc00f291 .word 0xfc00f291
|
|
400102c: 00000000 .word 0x00000000
|
|
|
|
04001030 <__unnamed_veneer>:
|
|
4001030: e51ff004 ldr pc, \[pc, #-4\] ; .*
|
|
4001034: 000081b0 .word 0x000081b0
|
|
|
|
04001038 <__unnamed_veneer>:
|
|
4001038: 4778 bx pc
|
|
400103a: 46c0 nop ; .*
|
|
400103c: e51ff004 ldr pc, \[pc, #-4\] ; .*
|
|
4001040: 000081b0 .word 0x000081b0
|
|
4001044: 00000000 .word 0x00000000
|