/* ECOFF debugging support.
- Copyright (C) 1993-2017 Free Software Foundation, Inc.
+ Copyright (C) 1993-2020 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file was put together by Ian Lance Taylor <ian@cygnus.com>. A
good deal of it comes directly from mips-tfile.c, by Michael
#26 48 0x00000030 struct no name { ifd = -1, index = 1048575 }
*/
\f
-/* Redefinition of of storage classes as an enumeration for better
+/* Redefinition of storage classes as an enumeration for better
debugging. */
typedef enum sc {
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);
}
\f
/* 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;
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"));
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,
if (stabs_seen)
{
(void) add_ecoff_symbol (file_name, st_Nil, sc_Nil,
- symbol_new ("L0\001", now_seg,
+ symbol_new (FAKE_LABEL_NAME, now_seg,
(valueT) frag_now_fix (),
frag_now),
(bfd_vma) 0, 0, ECOFF_MARK_STAB (N_SOL));
as_warn (_(".end directive names unknown symbol"));
else
(void) add_ecoff_symbol ((const char *) NULL, st_End, sc_Text,
- symbol_new ("L0\001", now_seg,
+ symbol_new (FAKE_LABEL_NAME, now_seg,
(valueT) frag_now_fix (),
frag_now),
(bfd_vma) 0, (symint_t) 0, (symint_t) 0);
+#ifdef md_flush_pending_output
+ md_flush_pending_output ();
+#endif
+
cur_proc_ptr = (proc_t *) NULL;
(void) restore_line_pointer (name_end);
/* Parse .ent directives. */
void
-ecoff_directive_ent (int ignore ATTRIBUTE_UNUSED)
+ecoff_directive_ent (int aent)
{
char *name;
char name_end;
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 ();
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);
if (stabs_seen)
{
(void) add_ecoff_symbol ((char *) NULL, st_Label, sc_Text,
- symbol_new ("L0\001", now_seg,
+ symbol_new (FAKE_LABEL_NAME, now_seg,
(valueT) frag_now_fix (),
frag_now),
(bfd_vma) 0, 0, lineno);
&& first_proc_ptr != (proc_t *) NULL
&& local_first_lineno != (lineno_list_t *) NULL
&& ((S_GET_VALUE (first_proc_ptr->sym->as_sym)
- + bfd_get_section_vma (stdoutput,
- S_GET_SEGMENT (first_proc_ptr->sym->as_sym)))
+ + bfd_section_vma (S_GET_SEGMENT (first_proc_ptr->sym->as_sym)))
!= 0))
{
first.file = local_first_lineno->file;
else
sym_ptr->ecoff_sym.asym.value =
(S_GET_VALUE (as_sym)
- + bfd_get_section_vma (stdoutput,
- S_GET_SEGMENT (as_sym))
+ + bfd_section_vma (S_GET_SEGMENT (as_sym))
+ sym_ptr->addend);
sym_ptr->ecoff_sym.weakext = S_IS_WEAK (as_sym);
/* If an st_end symbol has an associated gas
symbol, then it is a local label created for
a .bend or .end directive. Stabs line
- numbers will have \001 in the names. */
+ numbers will have FAKE_LABEL_CHAR in the names. */
if (local
&& sym_ptr->ecoff_sym.asym.st != st_End
- && strchr (sym_ptr->name, '\001') == 0)
+ && strchr (sym_ptr->name, FAKE_LABEL_CHAR) == 0)
sym_ptr->ecoff_sym.asym.iss =
add_string (&fil_ptr->strings,
fil_ptr->str_hash,
adr_sym = proc_ptr->sym->as_sym;
adr = (S_GET_VALUE (adr_sym)
- + bfd_get_section_vma (stdoutput,
- S_GET_SEGMENT (adr_sym)));
+ + bfd_section_vma (S_GET_SEGMENT (adr_sym)));
if (first)
{
/* This code used to force the adr of the very