public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][Binutils][AArch64] Have -D override mapping symbol as documented.
@ 2019-03-07 11:44 Tamar Christina
  2019-03-15  9:54 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Tamar Christina @ 2019-03-07 11:44 UTC (permalink / raw)
  To: binutils; +Cc: nd, Richard Earnshaw, Marcus Shawcroft

[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]

Hi All,

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?

build on native hardware and regtested on
  aarch64-none-elf, aarch64-none-elf (32 bit host),
  aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host)

Cross-compiled and regtested on
  aarch64-none-linux-gnu, aarch64_be-none-linux-gnu

and no issues.

Ok for master? and for backport to binutils-2.32?

Thanks,
Tamar

binutils/ChangeLog:

2019-03-07  Tamar Christina  <tamar.christina@arm.com>

	* 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:

2019-03-07  Tamar Christina  <tamar.christina@arm.com>

	* aarch64-dis.c (print_insn_aarch64):

-- 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: rb10778.patch --]
[-- Type: text/x-diff; name="rb10778.patch", Size: 5065 bytes --]

diff --git a/binutils/testsuite/binutils-all/aarch64/in-order-all.d b/binutils/testsuite/binutils-all/aarch64/in-order-all.d
new file mode 100644
index 0000000000000000000000000000000000000000..32f501b7d460b8a07954ee3680f26725542224e7
--- /dev/null
+++ b/binutils/testsuite/binutils-all/aarch64/in-order-all.d
@@ -0,0 +1,43 @@
+#PROG: objcopy
+#source: out-of-order.s
+#ld: -e v1 -Ttext-segment=0x400000
+#objdump: -D
+#name: Check if disassembler can handle all sections in default order
+
+.*: +file format .*aarch64.*
+
+Disassembly of section \.func1:
+
+0000000000400000 <v1>:
+  400000:	8b010000 	add	x0, x0, x1
+  400004:	00000000 	\.inst	0x00000000 ; undefined
+
+Disassembly of section \.func2:
+
+0000000000400008 <\.func2>:
+  400008:	8b010000 	add	x0, x0, x1
+
+Disassembly of section \.func3:
+
+000000000040000c <\.func3>:
+  40000c:	8b010000 	add	x0, x0, x1
+  400010:	8b010000 	add	x0, x0, x1
+  400014:	8b010000 	add	x0, x0, x1
+  400018:	8b010000 	add	x0, x0, x1
+  40001c:	8b010000 	add	x0, x0, x1
+  400020:	00000000 	\.inst	0x00000000 ; undefined
+
+Disassembly of section \.rodata:
+
+0000000000400024 <\.rodata>:
+  400024:	00000004 	\.inst	0x00000004 ; undefined
+
+Disassembly of section .global:
+
+0000000000410028 <__data_start>:
+  410028:	00000001 	\.inst	0x00000001 ; undefined
+  41002c:	00000000 	\.inst	0x00000000 ; undefined
+  410030:	00000001 	\.inst	0x00000001 ; undefined
+  410034:	00000000 	\.inst	0x00000000 ; undefined
+  410038:	00000001 	\.inst	0x00000001 ; undefined
+  41003c:	00000000 	\.inst	0x00000000 ; undefined
diff --git a/binutils/testsuite/binutils-all/aarch64/out-of-order-all.d b/binutils/testsuite/binutils-all/aarch64/out-of-order-all.d
new file mode 100644
index 0000000000000000000000000000000000000000..3020deff9c92c2c0e1cdcf17696d15f507e94485
--- /dev/null
+++ b/binutils/testsuite/binutils-all/aarch64/out-of-order-all.d
@@ -0,0 +1,43 @@
+#PROG: objcopy
+#source: out-of-order.s
+#ld: -T out-of-order.T
+#objdump: -D
+#name: Check if disassembler can handle all sections in different order than header
+
+.*: +file format .*aarch64.*
+
+Disassembly of section \.global:
+
+00000000ffe00000 <\.global>:
+    ffe00000:	00000001 	\.inst	0x00000001 ; undefined
+    ffe00004:	00000000 	\.inst	0x00000000 ; undefined
+    ffe00008:	00000001 	\.inst	0x00000001 ; undefined
+    ffe0000c:	00000000 	\.inst	0x00000000 ; undefined
+    ffe00010:	00000001 	\.inst	0x00000001 ; undefined
+    ffe00014:	00000000 	\.inst	0x00000000 ; undefined
+
+Disassembly of section \.func2:
+
+0000000004018280 <\.func2>:
+ 4018280:	8b010000 	add	x0, x0, x1
+
+Disassembly of section \.func1:
+
+0000000004005000 <v1>:
+ 4005000:	8b010000 	add	x0, x0, x1
+ 4005004:	00000000 	\.inst	0x00000000 ; undefined
+
+Disassembly of section \.func3:
+
+0000000004015000 <\.func3>:
+ 4015000:	8b010000 	add	x0, x0, x1
+ 4015004:	8b010000 	add	x0, x0, x1
+ 4015008:	8b010000 	add	x0, x0, x1
+ 401500c:	8b010000 	add	x0, x0, x1
+ 4015010:	8b010000 	add	x0, x0, x1
+ 4015014:	00000000 	\.inst	0x00000000 ; undefined
+
+Disassembly of section \.rodata:
+
+0000000004015018 <\.rodata>:
+ 4015018:	00000004 	\.inst	0x00000004 ; undefined
diff --git a/binutils/testsuite/binutils-all/aarch64/out-of-order.d b/binutils/testsuite/binutils-all/aarch64/out-of-order.d
index f78adec2162b0714f2f461111651f1cc6e561e13..410f37f68ea21f9e16e2319b5048c123cec99910 100644
--- a/binutils/testsuite/binutils-all/aarch64/out-of-order.d
+++ b/binutils/testsuite/binutils-all/aarch64/out-of-order.d
@@ -1,20 +1,10 @@
 #PROG: objcopy
 #ld: -T out-of-order.T
-#objdump: -D
+#objdump: -d
 #name: Check if disassembler can handle sections in different order than header
 
 .*: +file format .*aarch64.*
 
-Disassembly of section \.global:
-
-00000000ffe00000 <\.global>:
-    ffe00000:	00000001 	\.word	0x00000001
-    ffe00004:	00000000 	\.word	0x00000000
-    ffe00008:	00000001 	\.word	0x00000001
-    ffe0000c:	00000000 	\.word	0x00000000
-    ffe00010:	00000001 	\.word	0x00000001
-    ffe00014:	00000000 	\.word	0x00000000
-
 Disassembly of section \.func2:
 
 0000000004018280 <\.func2>:
@@ -35,8 +25,3 @@ Disassembly of section \.func3:
  401500c:	8b010000 	add	x0, x0, x1
  4015010:	8b010000 	add	x0, x0, x1
  4015014:	00000000 	\.word	0x00000000
-
-Disassembly of section \.rodata:
-
-0000000004015018 <\.rodata>:
- 4015018:	00000004 	\.word	0x00000004
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index 1f931d09327580ee9d257901655b3dad77b93837..eea649fd3cc96059a1f23170c91cc1cfe75efac3 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -3433,7 +3433,8 @@ print_insn_aarch64 (bfd_vma pc,
   else
     last_type = type;
 
-  if (last_type == MAP_DATA)
+  /* PR 10263: Disassemble data if requested to do so by the user.  */
+  if (last_type == MAP_DATA && ((info->flags & DISASSEMBLE_DATA) == 0))
     {
       /* size was set above.  */
       info->bytes_per_chunk = size;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][Binutils][AArch64] Have -D override mapping symbol as documented.
  2019-03-07 11:44 [PATCH][Binutils][AArch64] Have -D override mapping symbol as documented Tamar Christina
@ 2019-03-15  9:54 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2019-03-15  9:54 UTC (permalink / raw)
  To: Tamar Christina, binutils; +Cc: nd, Richard Earnshaw, Marcus Shawcroft

Hi Tamar,

> Ok for master? and for backport to binutils-2.32?

Approved for both.

> binutils/ChangeLog:
> 
> 2019-03-07  Tamar Christina  <tamar.christina@arm.com>
> 
> 	* 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:
> 
> 2019-03-07  Tamar Christina  <tamar.christina@arm.com>
> 
> 	* aarch64-dis.c (print_insn_aarch64):
> 

Cheers
  Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-15  9:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 11:44 [PATCH][Binutils][AArch64] Have -D override mapping symbol as documented Tamar Christina
2019-03-15  9:54 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).