Skip to content

Commit 60df372

Browse files
AArch64: Have -D override mapping symbol as documented.
The documentation for -D says that on Arm platforms -D should disassemble data as instructions. "If the target is an ARM architecture this switch also has the effect of forcing the disassembler to decode pieces of data found in code sections as if they were instructions. " This makes it do as it says on the tincan so it's more consistent with aarch32. The usecase here is for baremetal developers who have created their instructions using .word directives instead if .insn. Though for Linux users I do find this behavior somewhat non-optimal. Perhaps there should be a new flag that just disassembles the values following the actual mapping symbol? binutils/ChangeLog: * testsuite/binutils-all/aarch64/in-order-all.d: New test. * testsuite/binutils-all/aarch64/out-of-order-all.d: New test. * testsuite/binutils-all/aarch64/out-of-order.d: opcodes/ChangeLog: * aarch64-dis.c (print_insn_aarch64): Implement override.
1 parent 5145776 commit 60df372

File tree

6 files changed

+100
-17
lines changed

6 files changed

+100
-17
lines changed

binutils/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2019-03-25 Tamar Christina <[email protected]>
2+
3+
* testsuite/binutils-all/aarch64/in-order-all.d: New test.
4+
* testsuite/binutils-all/aarch64/out-of-order-all.d: New test.
5+
* testsuite/binutils-all/aarch64/out-of-order.d:
6+
17
2019-03-25 Tamar Christina <[email protected]>
28

39
* testsuite/binutils-all/aarch64/in-order.d: New test.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#PROG: objcopy
2+
#source: out-of-order.s
3+
#ld: -e v1 -Ttext-segment=0x400000
4+
#objdump: -D
5+
#name: Check if disassembler can handle all sections in default order
6+
7+
.*: +file format .*aarch64.*
8+
9+
Disassembly of section \.func1:
10+
11+
0000000000400000 <v1>:
12+
400000: 8b010000 add x0, x0, x1
13+
400004: 00000000 \.inst 0x00000000 ; undefined
14+
15+
Disassembly of section \.func2:
16+
17+
0000000000400008 <\.func2>:
18+
400008: 8b010000 add x0, x0, x1
19+
20+
Disassembly of section \.func3:
21+
22+
000000000040000c <\.func3>:
23+
40000c: 8b010000 add x0, x0, x1
24+
400010: 8b010000 add x0, x0, x1
25+
400014: 8b010000 add x0, x0, x1
26+
400018: 8b010000 add x0, x0, x1
27+
40001c: 8b010000 add x0, x0, x1
28+
400020: 00000000 \.inst 0x00000000 ; undefined
29+
30+
Disassembly of section \.rodata:
31+
32+
0000000000400024 <\.rodata>:
33+
400024: 00000004 \.inst 0x00000004 ; undefined
34+
35+
Disassembly of section .global:
36+
37+
0000000000410028 <__data_start>:
38+
410028: 00000001 \.inst 0x00000001 ; undefined
39+
41002c: 00000000 \.inst 0x00000000 ; undefined
40+
410030: 00000001 \.inst 0x00000001 ; undefined
41+
410034: 00000000 \.inst 0x00000000 ; undefined
42+
410038: 00000001 \.inst 0x00000001 ; undefined
43+
41003c: 00000000 \.inst 0x00000000 ; undefined
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#PROG: objcopy
2+
#source: out-of-order.s
3+
#ld: -T out-of-order.T
4+
#objdump: -D
5+
#name: Check if disassembler can handle all sections in different order than header
6+
7+
.*: +file format .*aarch64.*
8+
9+
Disassembly of section \.global:
10+
11+
00000000ffe00000 <\.global>:
12+
ffe00000: 00000001 \.inst 0x00000001 ; undefined
13+
ffe00004: 00000000 \.inst 0x00000000 ; undefined
14+
ffe00008: 00000001 \.inst 0x00000001 ; undefined
15+
ffe0000c: 00000000 \.inst 0x00000000 ; undefined
16+
ffe00010: 00000001 \.inst 0x00000001 ; undefined
17+
ffe00014: 00000000 \.inst 0x00000000 ; undefined
18+
19+
Disassembly of section \.func2:
20+
21+
0000000004018280 <\.func2>:
22+
4018280: 8b010000 add x0, x0, x1
23+
24+
Disassembly of section \.func1:
25+
26+
0000000004005000 <v1>:
27+
4005000: 8b010000 add x0, x0, x1
28+
4005004: 00000000 \.inst 0x00000000 ; undefined
29+
30+
Disassembly of section \.func3:
31+
32+
0000000004015000 <\.func3>:
33+
4015000: 8b010000 add x0, x0, x1
34+
4015004: 8b010000 add x0, x0, x1
35+
4015008: 8b010000 add x0, x0, x1
36+
401500c: 8b010000 add x0, x0, x1
37+
4015010: 8b010000 add x0, x0, x1
38+
4015014: 00000000 \.inst 0x00000000 ; undefined
39+
40+
Disassembly of section \.rodata:
41+
42+
0000000004015018 <\.rodata>:
43+
4015018: 00000004 \.inst 0x00000004 ; undefined
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
#PROG: objcopy
22
#ld: -T out-of-order.T
3-
#objdump: -D
3+
#objdump: -d
44
#name: Check if disassembler can handle sections in different order than header
55

66
.*: +file format .*aarch64.*
77

8-
Disassembly of section \.global:
9-
10-
00000000ffe00000 <\.global>:
11-
ffe00000: 00000001 \.word 0x00000001
12-
ffe00004: 00000000 \.word 0x00000000
13-
ffe00008: 00000001 \.word 0x00000001
14-
ffe0000c: 00000000 \.word 0x00000000
15-
ffe00010: 00000001 \.word 0x00000001
16-
ffe00014: 00000000 \.word 0x00000000
17-
188
Disassembly of section \.func2:
199

2010
0000000004018280 <\.func2>:
@@ -35,8 +25,3 @@ Disassembly of section \.func3:
3525
401500c: 8b010000 add x0, x0, x1
3626
4015010: 8b010000 add x0, x0, x1
3727
4015014: 00000000 \.word 0x00000000
38-
39-
Disassembly of section \.rodata:
40-
41-
0000000004015018 <\.rodata>:
42-
4015018: 00000004 \.word 0x00000004

opcodes/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2019-03-25 Tamar Christina <[email protected]>
2+
3+
* aarch64-dis.c (print_insn_aarch64):
4+
Implement override.
5+
16
2019-03-25 Tamar Christina <[email protected]>
27

38
* aarch64-dis.c (print_insn_aarch64): Update the mapping symbol search

opcodes/aarch64-dis.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3433,7 +3433,8 @@ print_insn_aarch64 (bfd_vma pc,
34333433
else
34343434
last_type = type;
34353435

3436-
if (last_type == MAP_DATA)
3436+
/* PR 10263: Disassemble data if requested to do so by the user. */
3437+
if (last_type == MAP_DATA && ((info->flags & DISASSEMBLE_DATA) == 0))
34373438
{
34383439
/* size was set above. */
34393440
info->bytes_per_chunk = size;

0 commit comments

Comments
 (0)