Mon Sep 12 17:51:39 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
+ * config/tc-mips.c (md_pseudo_table): Handle .globl and .global.
+ (s_mips_globl): New static function; needed for Irix 5 support.
+ * ecoff.c (ecoff_build_symbols): If BSF_FUNCTION is set for an
+ external symbol with no type, set the type to st_Proc rather than
+ st_Global. Don't set the index of an external st_Proc or
+ st_StaticProc symbol unless it is also a local symbol.
+
* read.c (read_a_source_file): The second argument to as_where is
unsigned int *, not int *.
static void s_err PARAMS ((int));
static void s_extern PARAMS ((int));
static void s_float_cons PARAMS ((int));
+static void s_mips_globl PARAMS ((int));
static void s_option PARAMS ((int));
static void s_mipsset PARAMS ((int));
static void s_mips_space PARAMS ((int));
{"double", s_float_cons, 'd'},
{"extern", s_extern, 0},
{"float", s_float_cons, 'f'},
+ {"globl", s_mips_globl, 0},
+ {"global", s_mips_globl, 0},
{"hword", s_cons, 1},
{"int", s_cons, 2},
{"long", s_cons, 2},
float_cons (type);
}
+/* Handle .globl. We need to override it because on Irix 5 you are
+ permitted to say
+ .globl foo .text
+ where foo is an undefined symbol, to mean that foo should be
+ considered to be the address of a function. */
+
+static void
+s_mips_globl (x)
+ int x;
+{
+ char *name;
+ int c;
+ symbolS *symbolP;
+
+ name = input_line_pointer;
+ c = get_symbol_end ();
+ symbolP = symbol_find_or_make (name);
+ *input_line_pointer = c;
+ SKIP_WHITESPACE ();
+ if (! is_end_of_line[(unsigned char) *input_line_pointer])
+ {
+ char *secname;
+ asection *sec;
+
+ secname = input_line_pointer;
+ c = get_symbol_end ();
+ sec = bfd_get_section_by_name (stdoutput, secname);
+ if (sec == NULL)
+ as_bad ("%s: no such section", secname);
+ *input_line_pointer = c;
+
+ if (sec != NULL && (sec->flags & SEC_CODE) != 0)
+ symbolP->bsym->flags |= BSF_FUNCTION;
+ }
+
+ S_SET_EXTERNAL (symbolP);
+ demand_empty_rest_of_line ();
+}
+
static void
s_option (x)
int x;
if (! ECOFF_IS_STAB (&sym_ptr->ecoff_sym.asym)
&& (S_IS_EXTERNAL (as_sym)
|| ! S_IS_DEFINED (as_sym)))
- st = st_Global;
+ {
+ if ((as_sym->bsym->flags & BSF_FUNCTION) != 0)
+ st = st_Proc;
+ else
+ st = st_Global;
+ }
else if (seg == text_section)
st = st_Label;
else
if (as_sym != (symbolS *) NULL
&& as_sym->ecoff_symbol == sym_ptr)
{
- if (sym_ptr->ecoff_sym.asym.st == st_Proc
- || sym_ptr->ecoff_sym.asym.st == st_StaticProc)
- {
- know (local);
- sym_ptr->ecoff_sym.asym.index = isym - ifilesym - 1;
- }
+ if ((sym_ptr->ecoff_sym.asym.st == st_Proc
+ || sym_ptr->ecoff_sym.asym.st == st_StaticProc)
+ && local)
+ sym_ptr->ecoff_sym.asym.index = isym - ifilesym - 1;
sym_ptr->ecoff_sym.ifd = fil_ptr->file_index;
}
}