ecoff_symbol_new_hook (symbolP)
symbolS *symbolP;
{
- if (cur_file_ptr == (efdr_t *) NULL)
+ /* Make sure that we have a file pointer, but only if we have seen a
+ file. If we haven't seen a file, then this is a probably special
+ symbol created by md_begin which may required special handling at
+ some point. Creating a dummy file with a dummy name is certainly
+ wrong. */
+ if (cur_file_ptr == (efdr_t *) NULL
+ && seen_at_least_1_file ())
add_file ((const char *) NULL, 0);
symbolP->ecoff_file = cur_file_ptr;
symbolP->ecoff_symbol = NULL;
as_fatal ("fake .file after real one");
as_where (&file, (unsigned int *) NULL);
file_name = (const char *) file;
- generate_asm_line_stab = 1;
+
+ if (! symbol_table_frozen)
+ generate_asm_lineno = 1;
}
else
- generate_asm_line_stab = 0;
+ generate_asm_lineno = 0;
#ifndef NO_LISTING
if (listing)
fil_ptr->int_type = add_aux_sym_tir (&int_type_info,
hash_yes,
&cur_file_ptr->thash_head[0]);
- if (generate_asm_line_stab)
+ /* gas used to have a bug that if the file does not have any
+ symbol, it either will abort or will not build the file,
+ the following is to get around that problem. ---kung*/
+#if 0
+ if (generate_asm_lineno)
{
- static char itstr[] = "void:t1=1";
mark_stabs (0);
(void) add_ecoff_symbol (file_name, st_Nil, sc_Nil,
- symbol_new ("L0\001", now_seg,
- (valueT) frag_now_fix (),
- frag_now),
- 0, ECOFF_MARK_STAB (N_SO));
- (void) add_ecoff_symbol (itstr, st_Nil, sc_Nil,
- (symbolS *)NULL, 0, ECOFF_MARK_STAB (N_LSYM));
+ symbol_new ("L0\001", now_seg,
+ (valueT) frag_now_fix (),
+ frag_now),
+ 0, ECOFF_MARK_STAB (N_SO));
+ (void) add_ecoff_symbol ("void:t1=1", st_Nil, sc_Nil,
+ (symbolS *) NULL, 0,
+ ECOFF_MARK_STAB (N_LSYM));
}
+#endif
}
}
\f
(valueT) frag_now_fix (),
frag_now),
(symint_t) 0, (symint_t) 0);
- if (generate_asm_line_stab)
+
+ if (stabs_seen && generate_asm_lineno)
{
char *n;
cur_file_ptr = save_file_ptr;
}
+int
+ecoff_no_current_file ()
+{
+ return cur_file_ptr == (efdr_t *) NULL;
+}
+
+void
+ecoff_generate_asm_lineno (filename, lineno)
+ char *filename;
+ int lineno;
+{
+ lineno_list_t *list;
+
+ /* this potential can cause problem, when we start to see stab half the
+ way thru the file */
+/*
+ if (stabs_seen)
+ ecoff_generate_asm_line_stab(filename, lineno);
+*/
+
+ if (strcmp (current_stabs_filename, filename))
+ {
+ add_file (filename, 0);
+ generate_asm_lineno = 1;
+ }
+
+ list = allocate_lineno_list ();
+
+ list->next = (lineno_list_t *) NULL;
+ list->file = cur_file_ptr;
+ list->proc = cur_proc_ptr;
+ list->frag = frag_now;
+ list->paddr = frag_now_fix ();
+ list->lineno = lineno;
+
+ /* A .loc directive will sometimes appear before a .ent directive,
+ which means that cur_proc_ptr will be NULL here. Arrange to
+ patch this up. */
+ if (cur_proc_ptr == (proc_t *) NULL)
+ {
+ lineno_list_t **pl;
+
+ pl = &noproc_lineno;
+ while (*pl != (lineno_list_t *) NULL)
+ pl = &(*pl)->next;
+ *pl = list;
+ }
+ else
+ {
+ *last_lineno_ptr = list;
+ last_lineno_ptr = &list->next;
+ }
+}
+
static int line_label_cnt = 0;
void
ecoff_generate_asm_line_stab (filename, lineno)
if (strcmp (current_stabs_filename, filename))
{
add_file (filename, 0);
- generate_asm_line_stab = 1;
+ generate_asm_lineno = 1;
}
line_label_cnt++;