aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/config/obj-ecoff.c5
-rw-r--r--gas/config/obj-elf.c1
-rw-r--r--gas/ecoff.c26
-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
8 files changed, 76 insertions, 14 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d494dc7..a15f92e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2017-02-17 Maciej W. Rozycki <macro@imgtec.com>
+
+ * 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.
+
2017-02-15 Richard Sandiford <richard.sandiford@arm.com>
* testsuite/gas/aarch64/sve-sysreg.s,
diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c
index 8458a91..80ae37e 100644
--- a/gas/config/obj-ecoff.c
+++ b/gas/config/obj-ecoff.c
@@ -221,8 +221,8 @@ ecoff_separate_stab_sections (void)
relating to debugging information are supported here.
The following pseudo-ops from the Kane and Heinrich MIPS book
- should be defined here, but are currently unsupported: .aent,
- .bgnb, .endb, .verstamp, .vreg.
+ should be defined here, but are currently unsupported: .bgnb,
+ .endb, .verstamp, .vreg.
The following pseudo-ops from the Kane and Heinrich MIPS book are
MIPS CPU specific, and should be defined by tc-mips.c: .alias,
@@ -253,6 +253,7 @@ const pseudo_typeS obj_pseudo_table[] =
{ "val", ecoff_directive_val, 0 },
/* ECOFF specific debugging information. */
+ { "aent", ecoff_directive_ent, 1 },
{ "begin", ecoff_directive_begin, 0 },
{ "bend", ecoff_directive_bend, 0 },
{ "end", ecoff_directive_end, 0 },
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 165fc8b..1d59fc0 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -164,6 +164,7 @@ static const pseudo_typeS ecoff_debug_pseudo_table[] =
{ "etype", ecoff_directive_type, 0 },
/* ECOFF specific debugging information. */
+ { "aent", ecoff_directive_ent, 1 },
{ "begin", ecoff_directive_begin, 0 },
{ "bend", ecoff_directive_bend, 0 },
{ "end", ecoff_directive_end, 0 },
diff --git a/gas/ecoff.c b/gas/ecoff.c
index 171f2db..5c37312 100644
--- a/gas/ecoff.c
+++ b/gas/ecoff.c
@@ -1422,7 +1422,7 @@ static symint_t add_aux_sym_tir (type_info_t *t,
thash_t **hash_tbl);
static tag_t *get_tag (const char *tag, localsym_t *sym, bt_t basic_type);
static void add_unknown_tag (tag_t *ptag);
-static void add_procedure (char *func);
+static void add_procedure (char *func, int aent);
static void add_file (const char *file_name, int indx, int fake);
#ifdef ECOFF_DEBUG
static char *sc_to_string (sc_t storage_class);
@@ -2109,10 +2109,11 @@ add_unknown_tag (tag_t *ptag /* pointer to tag information */)
}
/* Add a procedure to the current file's list of procedures, and record
- this is the current procedure. */
+ this is the current procedure. If AENT, then only set the requested
+ symbol's function type. */
static void
-add_procedure (char *func /* func name */)
+add_procedure (char *func /* func name */, int aent)
{
varray_t *vp;
proc_t *new_proc_ptr;
@@ -2123,6 +2124,13 @@ add_procedure (char *func /* func name */)
fputc ('\n', stderr);
#endif
+ /* Set the BSF_FUNCTION flag for the symbol. */
+ sym = symbol_find_or_make (func);
+ symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
+
+ if (aent)
+ return;
+
if (cur_file_ptr == (efdr_t *) NULL)
as_fatal (_("no current file pointer"));
@@ -2143,10 +2151,6 @@ add_procedure (char *func /* func name */)
new_proc_ptr->pdr.lnLow = -1;
new_proc_ptr->pdr.lnHigh = -1;
- /* Set the BSF_FUNCTION flag for the symbol. */
- sym = symbol_find_or_make (func);
- symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
-
/* Push the start of the function. */
new_proc_ptr->sym = add_ecoff_symbol ((const char *) NULL, st_Proc, sc_Text,
sym, (bfd_vma) 0, (symint_t) 0,
@@ -3030,7 +3034,7 @@ ecoff_directive_end (int ignore ATTRIBUTE_UNUSED)
/* Parse .ent directives. */
void
-ecoff_directive_ent (int ignore ATTRIBUTE_UNUSED)
+ecoff_directive_ent (int aent)
{
char *name;
char name_end;
@@ -3038,7 +3042,7 @@ ecoff_directive_ent (int ignore ATTRIBUTE_UNUSED)
if (cur_file_ptr == (efdr_t *) NULL)
add_file ((const char *) NULL, 0, 1);
- if (cur_proc_ptr != (proc_t *) NULL)
+ if (!aent && cur_proc_ptr != (proc_t *) NULL)
{
as_warn (_("second .ent directive found before .end directive"));
demand_empty_rest_of_line ();
@@ -3049,13 +3053,13 @@ ecoff_directive_ent (int ignore ATTRIBUTE_UNUSED)
if (name == input_line_pointer)
{
- as_warn (_(".ent directive has no name"));
+ as_warn (_("%s directive has no name"), aent ? ".aent" : ".ent");
(void) restore_line_pointer (name_end);
demand_empty_rest_of_line ();
return;
}
- add_procedure (name);
+ add_procedure (name, aent);
(void) restore_line_pointer (name_end);
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]