summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2022-12-05 13:52:55 +0100
committerJan Beulich <jbeulich@suse.com>2022-12-05 13:52:55 +0100
commit6fdb723799e28de9a7df87b68a41c668fc18ce2a (patch)
treeeb56064c8fd66f0cc45247d1eab79b628aaad115
parentc62e507e849f3461254a88298aa25c970e4339c8 (diff)
downloadbinutils-gdb-6fdb723799e28de9a7df87b68a41c668fc18ce2a.tar.gz
gas: add Dwarf line number test for .macro expansions
Before fiddling with the code let's put in place a test covering what PR/gas 16908 aimed at.
-rw-r--r--gas/testsuite/gas/elf/dwarf-5-macro.d27
-rw-r--r--gas/testsuite/gas/elf/dwarf-5-macro.s28
-rw-r--r--gas/testsuite/gas/elf/elf.exp1
3 files changed, 56 insertions, 0 deletions
diff --git a/gas/testsuite/gas/elf/dwarf-5-macro.d b/gas/testsuite/gas/elf/dwarf-5-macro.d
new file mode 100644
index 00000000000..794e17a575e
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf-5-macro.d
@@ -0,0 +1,27 @@
+#as: --gdwarf-5
+#name: line number entries for .macro expansions
+#readelf: -W -wl
+# The am33 cr16 crx ft32 mn10* msp430 nds32* and rl78 targets do not evaluate the subtraction of symbols at assembly time.
+# The d30v target emits sufficiently different debug info, apparently also covering padding it inserts.
+# The riscv targets do not support the subtraction of symbols.
+#xfail: am33*-* cr16-* crx-* d30v-* ft32-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
+
+Raw dump of debug contents .*
+#...
+ Line Number Statements:
+.*Extended opcode 2: .*
+.*Advance Line by 10017 to 10018
+.*(Copy|Special opcode .* Address by 0 .* and Line by 0 to 10018)
+.*Special opcode .* and Line by 1 to 10019
+.*Special opcode .* and Line by 1 to 10020
+.*Set File Name to entry 2 .*
+.*Advance Line by -10012 to 8
+.*Special opcode .* and Line by 0 to 8
+.*Set File Name to entry 1 .*
+.*Advance Line by 10018 to 10026
+.*(Advance PC by .*|Special opcode .* and Line by 0 to 10026)
+#...
+.*Special opcode .* and Line by 1 to 10027
+.*Special opcode .* and Line by 1 to 10028
+.*Advance PC by .*
+.*Extended opcode 1: End of Sequence
diff --git a/gas/testsuite/gas/elf/dwarf-5-macro.s b/gas/testsuite/gas/elf/dwarf-5-macro.s
new file mode 100644
index 00000000000..23be186f9ca
--- /dev/null
+++ b/gas/testsuite/gas/elf/dwarf-5-macro.s
@@ -0,0 +1,28 @@
+ .macro m1 args:vararg
+ .nop
+ .endm
+
+ .macro m2 args:vararg
+ .file "Line.s"
+ .line 7
+ .nop
+ .endm
+
+ .macro m3 args:vararg
+# 10013 "line.S"
+ .nop
+ .endm
+
+ .text
+macro:
+ m1 1
+ m1 2
+ m1 3
+
+ m2 1
+ m2 2
+ m2 3
+
+ m3 1
+ m3 2
+ m3 3
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 07f08a00a28..145814b62be 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -308,6 +308,7 @@ if { [is_elf_format] } then {
run_dump_test "dwarf-5-cu" $dump_opts
run_dump_test "dwarf-5-nop-for-line-table" $dump_opts
run_dump_test "dwarf-5-irp" $dump_opts
+ run_dump_test "dwarf-5-macro" $dump_opts
run_dump_test "dwarf-3-func" $dump_opts
run_dump_test "dwarf-5-func" $dump_opts
run_dump_test "dwarf-5-func-global" $dump_opts