* 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.
This commit is contained in:
Ian Lance Taylor 1994-09-12 22:11:18 +00:00
parent 1b434ced73
commit c1444ec48f
3 changed files with 59 additions and 7 deletions

View File

@ -1,5 +1,12 @@
Mon Sep 12 17:51:39 1994 Ian Lance Taylor (ian@sanguine.cygnus.com) 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 * read.c (read_a_source_file): The second argument to as_where is
unsigned int *, not int *. unsigned int *, not int *.

View File

@ -378,6 +378,7 @@ static void s_cons PARAMS ((int));
static void s_err PARAMS ((int)); static void s_err PARAMS ((int));
static void s_extern PARAMS ((int)); static void s_extern PARAMS ((int));
static void s_float_cons 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_option PARAMS ((int));
static void s_mipsset PARAMS ((int)); static void s_mipsset PARAMS ((int));
static void s_mips_space PARAMS ((int)); static void s_mips_space PARAMS ((int));
@ -450,6 +451,8 @@ const pseudo_typeS md_pseudo_table[] =
{"double", s_float_cons, 'd'}, {"double", s_float_cons, 'd'},
{"extern", s_extern, 0}, {"extern", s_extern, 0},
{"float", s_float_cons, 'f'}, {"float", s_float_cons, 'f'},
{"globl", s_mips_globl, 0},
{"global", s_mips_globl, 0},
{"hword", s_cons, 1}, {"hword", s_cons, 1},
{"int", s_cons, 2}, {"int", s_cons, 2},
{"long", s_cons, 2}, {"long", s_cons, 2},
@ -5754,6 +5757,45 @@ s_float_cons (type)
float_cons (type); 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 static void
s_option (x) s_option (x)
int x; int x;

View File

@ -3904,7 +3904,12 @@ ecoff_build_symbols (backend, buf, bufend, offset)
if (! ECOFF_IS_STAB (&sym_ptr->ecoff_sym.asym) if (! ECOFF_IS_STAB (&sym_ptr->ecoff_sym.asym)
&& (S_IS_EXTERNAL (as_sym) && (S_IS_EXTERNAL (as_sym)
|| ! S_IS_DEFINED (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) else if (seg == text_section)
st = st_Label; st = st_Label;
else else
@ -4084,12 +4089,10 @@ ecoff_build_symbols (backend, buf, bufend, offset)
if (as_sym != (symbolS *) NULL if (as_sym != (symbolS *) NULL
&& as_sym->ecoff_symbol == sym_ptr) && as_sym->ecoff_symbol == sym_ptr)
{ {
if (sym_ptr->ecoff_sym.asym.st == st_Proc if ((sym_ptr->ecoff_sym.asym.st == st_Proc
|| sym_ptr->ecoff_sym.asym.st == st_StaticProc) || sym_ptr->ecoff_sym.asym.st == st_StaticProc)
{ && local)
know (local); sym_ptr->ecoff_sym.asym.index = isym - ifilesym - 1;
sym_ptr->ecoff_sym.asym.index = isym - ifilesym - 1;
}
sym_ptr->ecoff_sym.ifd = fil_ptr->file_index; sym_ptr->ecoff_sym.ifd = fil_ptr->file_index;
} }
} }