[binutils-gdb] Arm64: arrange for line number emission for .inst
Jan Beulich
jbeulich@sourceware.org
Thu Apr 7 06:18:22 GMT 2022
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0f47cb17d14172a5250b2146b82583271280d170
commit 0f47cb17d14172a5250b2146b82583271280d170
Author: Jan Beulich <jbeulich@suse.com>
Date: Thu Apr 7 08:16:29 2022 +0200
Arm64: arrange for line number emission for .inst
Just like insns encoded the more conventional way these should have line
number info associated with them.
Diff:
---
gas/config/tc-aarch64.c | 6 +++++-
gas/testsuite/gas/aarch64/inst-directive.d | 3 +++
gas/testsuite/gas/aarch64/inst-directive.s | 1 +
gas/testsuite/gas/aarch64/inst-dwarf.d | 15 +++++++++++++++
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index a4ef65274e4..cbebc6b48c8 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -1982,6 +1982,7 @@ static void
s_aarch64_inst (int ignored ATTRIBUTE_UNUSED)
{
expressionS exp;
+ unsigned n = 0;
#ifdef md_flush_pending_output
md_flush_pending_output ();
@@ -2020,10 +2021,13 @@ s_aarch64_inst (int ignored ATTRIBUTE_UNUSED)
unsigned int val = exp.X_add_number;
exp.X_add_number = SWAP_32 (val);
}
- emit_expr (&exp, 4);
+ emit_expr (&exp, INSN_SIZE);
+ ++n;
}
while (*input_line_pointer++ == ',');
+ dwarf2_emit_insn (n * INSN_SIZE);
+
/* Put terminator back into stream. */
input_line_pointer--;
demand_empty_rest_of_line ();
diff --git a/gas/testsuite/gas/aarch64/inst-directive.d b/gas/testsuite/gas/aarch64/inst-directive.d
index fa64ce85964..36a135f29a4 100644
--- a/gas/testsuite/gas/aarch64/inst-directive.d
+++ b/gas/testsuite/gas/aarch64/inst-directive.d
@@ -6,3 +6,6 @@ Disassembly of section \.text:
0+ <.*>:
0: 3619194c tbz w12, #3, 2328 <\.text\+0x2328>
+ *[0-9a-f]*: d503201f nop
+ *[0-9a-f]*: d503201f nop
+ *[0-9a-f]*: d503201f nop
diff --git a/gas/testsuite/gas/aarch64/inst-directive.s b/gas/testsuite/gas/aarch64/inst-directive.s
index e928362efea..1c2e9bc591b 100644
--- a/gas/testsuite/gas/aarch64/inst-directive.s
+++ b/gas/testsuite/gas/aarch64/inst-directive.s
@@ -3,3 +3,4 @@
.text
.inst 0x3619194c
+ .inst 0xd503201f, 0xd503201f, 0xd503201f
diff --git a/gas/testsuite/gas/aarch64/inst-dwarf.d b/gas/testsuite/gas/aarch64/inst-dwarf.d
new file mode 100644
index 00000000000..f5c0d3503f0
--- /dev/null
+++ b/gas/testsuite/gas/aarch64/inst-dwarf.d
@@ -0,0 +1,15 @@
+#as: -gdwarf-2
+#name: Dwarf line number info for .inst
+#objdump: -WL -w
+#source: inst-directive.s
+
+.*:[ ]+file format .*
+
+Contents of the .debug_line section:
+
+CU: .*/inst-directive.s:
+File name +Line number +Starting address.*
+inst-directive.s +5 +0.*
+inst-directive.s +6 +0x4.*
+inst-directive.s +- +0x10
+#pass
More information about the Binutils-cvs
mailing list