aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2017-02-16 01:50:29 +0000
committerMaciej W. Rozycki <macro@imgtec.com>2017-02-17 21:29:11 +0000
commit37f9ec62dbead711fe795cff2a95862ea8283c2f (patch)
treee87ed029ae8bf223cc1843221d5a3b7a97368698 /gas/testsuite
parent67cecaba5f70e540ad2f4bde21c323c0bde0f2d9 (diff)
downloadgdb-37f9ec62dbead711fe795cff2a95862ea8283c2f.zip
gdb-37f9ec62dbead711fe795cff2a95862ea8283c2f.tar.gz
gdb-37f9ec62dbead711fe795cff2a95862ea8283c2f.tar.bz2
GAS: Add ECOFF `.aent' pseudo-op support
Implement the ECOFF `.aent' pseudo-op for ECOFF-style `.mdebug' section support with ELF objects and, for consistency, also with ECOFF objects. This is so that the same MIPS source can be assembled without and with `.mdebug' section generation enabled. Taking the `gas/testsuite/gas/mips/aent.s' test case source as an example and the `mips-linux' target we have: $ as -o aent.o aent.s $ as -mdebug -o aent.o aent.s aent.s: Assembler messages: aent.s:10: Error: unknown pseudo-op: `.aent' $ because for the !ECOFF_DEBUGGING case (which is the default) the pseudo-op is already handled by the MIPS backend with `s_mips_ent', however no handler is present for the opposite case. For the MIPS target this is a functional regression introduced with commit ecb4347adecd ("Last take: approval for MIPS_STABS_ELF killing"), <https://sourceware.org/ml/binutils/2002-06/msg00443.html>, where support for the `.mdebug' section was added along with its associated `-mdebug'/`-no-mdebug' command-line options, bringing an inconsistency between the assembly syntax supported for each of these options as far as the `.aent' pseudo-op is concerned. Assembly language documentation available describes the pseudo-op respectively as follows[1]: " .aent name, symno Sets an alternate entry point for the current procedure. Use this information when you want to generate information for the debugger. It must appear inside an .ent/.end pair." and[2]: " .aent name [,symno] Sets an alternate entry point for the current procedure. Use this information when you want to generate information for the debugger. This directive must appear between a pair of .ent and .end directives. (The optional symno is for compiler use only. It refers to a dense number in a .T file (symbol table).)" Copy the approach from `s_mips_ent' then and add `.aent' support to the `.ent' pseudo-op handler shared between the ELF and ECOFF object file format backends, by setting BSF_FUNCTION for the symbol requested. References: [1] "MIPSpro Assembly Language Programmer's Guide", Silicon Graphics, Inc., Document Number 007-2418-004, Section 8.1 "Op-Codes", p. 96 <http://techpubs.sgi.com/library/manuals/2000/007-2418-004/pdf/007-2418-004.pdf> [2] "Digital UNIX Assembly Language Programmer's Guide", Digital Equipment Corporation, Order Number: AA-PS31D-TE, March 1996, Chapter 5 "Assembler Directives", p. 5-2 <http://h41361.www4.hpe.com/docs/base_doc/DOCUMENTATION/V40G_PDF/APS31DTE.PDF> gas/ * ecoff.c (ecoff_directive_ent, add_procedure): Handle `.aent'. * config/obj-ecoff.c (obj_pseudo_table): Add "aent" entry. * config/obj-elf.c (ecoff_debug_pseudo_table): Likewise. * testsuite/gas/mips/aent-2.d: New test. * testsuite/gas/mips/aent-mdebug.d: New test. * testsuite/gas/mips/aent-mdebug-2.d: New test. * testsuite/gas/mips/mips.exp: Run the new tests.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/gas/mips/aent-2.d19
-rw-r--r--gas/testsuite/gas/mips/aent-mdebug-2.d16
-rw-r--r--gas/testsuite/gas/mips/aent-mdebug.d7
-rw-r--r--gas/testsuite/gas/mips/mips.exp6
4 files changed, 47 insertions, 1 deletions
diff --git a/gas/testsuite/gas/mips/aent-2.d b/gas/testsuite/gas/mips/aent-2.d
new file mode 100644
index 0000000..4115919
--- /dev/null
+++ b/gas/testsuite/gas/mips/aent-2.d
@@ -0,0 +1,19 @@
+#PROG: readelf
+#readelf: -s
+#name: MIPS .aent directive 2
+#as: -32
+#source: aent.s
+
+# Verify that the .aent directive retains function symbol type annotation,
+# e.g.:
+# Num: Value Size Type Bind Vis Ndx Name
+# 8: 00000000 16 FUNC GLOBAL DEFAULT 1 foo
+# 9: 00000008 0 FUNC GLOBAL DEFAULT 1 bar
+# vs:
+# Num: Value Size Type Bind Vis Ndx Name
+# 8: 00000000 16 FUNC GLOBAL DEFAULT 1 foo
+# 9: 00000008 0 OBJECT GLOBAL DEFAULT 1 bar
+#...
+ *[0-9]+: +[0-9]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT(?: +\[[^]]*\])? +[0-9]+ foo
+ *[0-9]+: +[0-9]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT(?: +\[[^]]*\])? +[0-9]+ bar
+#pass
diff --git a/gas/testsuite/gas/mips/aent-mdebug-2.d b/gas/testsuite/gas/mips/aent-mdebug-2.d
new file mode 100644
index 0000000..eea4115
--- /dev/null
+++ b/gas/testsuite/gas/mips/aent-mdebug-2.d
@@ -0,0 +1,16 @@
+#PROG: readelf
+#readelf: -s
+#name: MIPS .aent directive with ECOFF debug 2
+#as: -32 -mdebug
+#source: aent.s
+#dump: aent-2.d
+
+# Verify that the .aent directive retains function symbol type annotation,
+# e.g.:
+# Num: Value Size Type Bind Vis Ndx Name
+# 8: 00000000 16 FUNC GLOBAL DEFAULT 1 foo
+# 9: 00000008 0 FUNC GLOBAL DEFAULT 1 bar
+# vs:
+# Num: Value Size Type Bind Vis Ndx Name
+# 8: 00000000 16 FUNC GLOBAL DEFAULT 1 foo
+# 9: 00000008 0 OBJECT GLOBAL DEFAULT 1 bar
diff --git a/gas/testsuite/gas/mips/aent-mdebug.d b/gas/testsuite/gas/mips/aent-mdebug.d
new file mode 100644
index 0000000..1a373c6
--- /dev/null
+++ b/gas/testsuite/gas/mips/aent-mdebug.d
@@ -0,0 +1,7 @@
+#objdump: -dr --prefix-addresses
+#name: MIPS .aent directive with ECOFF debug
+#as: -32 -mdebug
+#source: aent.s
+#dump: aent.d
+
+# Test the .aent directive retains function symbol type annotation.
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index 5a69542..8a9f9f1 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1191,7 +1191,11 @@ if { [istarget mips*-*-vxworks*] } {
!micromips]
}
- run_dump_test_arches "aent" [mips_arch_list_matching mips1]
+ run_dump_test_arches "aent" [mips_arch_list_matching mips1]
+ run_dump_test_arches "aent-2" [mips_arch_list_matching mips1]
+ run_dump_test_arches "aent-mdebug" [mips_arch_list_matching mips1]
+ run_dump_test_arches "aent-mdebug-2" \
+ [mips_arch_list_matching mips1]
run_dump_test_arches "loc-swap" [mips_arch_list_all]
run_dump_test_arches "loc-swap-dis" [mips_arch_list_all]