(ecoff_set_gp_prolog_size): New function.
(current_file_idx): New static variable. (add_file): Use and increment current_file_idx instead of indx parameter. Also removed trailing whitespace from lines.
This commit is contained in:
parent
69ecc03f3d
commit
012353f7d1
122
gas/ecoff.c
122
gas/ecoff.c
|
@ -1401,6 +1401,7 @@ static int debug = 0; /* trace functions */
|
|||
#endif
|
||||
static int stabs_seen = 0; /* != 0 if stabs have been seen */
|
||||
|
||||
static int current_file_idx;
|
||||
|
||||
/* Pseudo symbol to use when putting stabs into the symbol table. */
|
||||
#ifndef STABS_SYMBOL
|
||||
|
@ -1462,10 +1463,7 @@ static unsigned long ecoff_build_ss
|
|||
static unsigned long ecoff_build_fdr
|
||||
PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
|
||||
unsigned long offset));
|
||||
static unsigned long ecoff_build_ext
|
||||
PARAMS ((const struct ecoff_debug_swap *backend, char **buf, char **bufend,
|
||||
unsigned long offset, varray_t *ext_strings,
|
||||
struct hash_control *ext_str_hash));
|
||||
static void ecoff_setup_ext PARAMS ((void));
|
||||
static page_t *allocate_cluster PARAMS ((unsigned long npages));
|
||||
static page_t *allocate_page PARAMS ((void));
|
||||
static scope_t *allocate_scope PARAMS ((void));
|
||||
|
@ -2232,7 +2230,7 @@ add_file (file_name, indx)
|
|||
&file_desc.last->datum->file[file_desc.objects_last_page++];
|
||||
*fil_ptr = init_file;
|
||||
|
||||
fil_ptr->file_index = indx;
|
||||
fil_ptr->file_index = current_file_idx++;
|
||||
++file_desc.num_allocated;
|
||||
|
||||
/* Allocate the string hash table. */
|
||||
|
@ -3120,7 +3118,13 @@ ecoff_directive_frame (ignore)
|
|||
|
||||
cur_proc_ptr->pdr.pcreg = tc_get_register (0);
|
||||
|
||||
#if 0 /* Alpha-OSF1 adds "the offset of saved $a0 from $sp", according
|
||||
to Sandro. I don't yet know where this value should be stored, if
|
||||
anywhere. */
|
||||
demand_empty_rest_of_line ();
|
||||
#else
|
||||
s_ignore (42);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Parse .mask directives. */
|
||||
|
@ -3289,6 +3293,7 @@ ecoff_stab (what, string, type, other, desc)
|
|||
st_t st;
|
||||
sc_t sc;
|
||||
symint_t indx;
|
||||
localsym_t *hold = NULL;
|
||||
|
||||
/* We don't handle .stabd. */
|
||||
if (what != 's' && what != 'n')
|
||||
|
@ -3401,8 +3406,17 @@ ecoff_stab (what, string, type, other, desc)
|
|||
indx = ECOFF_MARK_STAB (type);
|
||||
}
|
||||
|
||||
/* Don't store the stabs symbol we are creating as the type of the
|
||||
ECOFF symbol. We want to compute the type of the ECOFF symbol
|
||||
independently. */
|
||||
if (sym != (symbolS *) NULL)
|
||||
hold = sym->ecoff_symbol;
|
||||
|
||||
(void) add_ecoff_symbol (string, st, sc, sym, value, indx);
|
||||
|
||||
if (sym != (symbolS *) NULL)
|
||||
sym->ecoff_symbol = hold;
|
||||
|
||||
/* Restore normal file type. */
|
||||
cur_file_ptr = save_file_ptr;
|
||||
}
|
||||
|
@ -3778,8 +3792,9 @@ ecoff_build_symbols (backend, buf, bufend, offset)
|
|||
seg = S_GET_SEGMENT (as_sym);
|
||||
segname = segment_name (seg);
|
||||
|
||||
if (S_IS_EXTERNAL (as_sym)
|
||||
|| ! S_IS_DEFINED (as_sym))
|
||||
if (! ECOFF_IS_STAB (&sym_ptr->ecoff_sym.asym)
|
||||
&& (S_IS_EXTERNAL (as_sym)
|
||||
|| ! S_IS_DEFINED (as_sym)))
|
||||
st = st_Global;
|
||||
else if (seg == text_section)
|
||||
st = st_Label;
|
||||
|
@ -3954,7 +3969,8 @@ ecoff_build_symbols (backend, buf, bufend, offset)
|
|||
/* Record the local symbol index and file number in
|
||||
case this is an external symbol. Note that this
|
||||
destroys the asym.index field. */
|
||||
if (as_sym != (symbolS *) NULL)
|
||||
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)
|
||||
|
@ -4308,27 +4324,15 @@ ecoff_build_fdr (backend, buf, bufend, offset)
|
|||
return offset + ifile * external_fdr_size;
|
||||
}
|
||||
|
||||
/* Swap out the external symbols. These are the symbols that the
|
||||
machine independent code has put in the symtab for the BFD. */
|
||||
/* Set up the external symbols. These are supposed to be handled by
|
||||
the backend. This routine just gets the right information and
|
||||
calls a backend function to deal with it. */
|
||||
|
||||
static unsigned long
|
||||
ecoff_build_ext (backend, buf, bufend, offset, ext_strings, ext_str_hash)
|
||||
const struct ecoff_debug_swap *backend;
|
||||
char **buf;
|
||||
char **bufend;
|
||||
unsigned long offset;
|
||||
varray_t *ext_strings;
|
||||
struct hash_control *ext_str_hash;
|
||||
static void
|
||||
ecoff_setup_ext ()
|
||||
{
|
||||
const bfd_size_type external_ext_size = backend->external_ext_size;
|
||||
void (* const swap_ext_out) PARAMS ((bfd *, const EXTR *, PTR))
|
||||
= backend->swap_ext_out;
|
||||
register symbolS *sym;
|
||||
char *ext_out;
|
||||
long iext;
|
||||
|
||||
ext_out = *buf + offset;
|
||||
iext = 0;
|
||||
for (sym = symbol_rootP; sym != (symbolS *) NULL; sym = symbol_next (sym))
|
||||
{
|
||||
if (sym->ecoff_symbol == NULL)
|
||||
|
@ -4344,20 +4348,8 @@ ecoff_build_ext (backend, buf, bufend, offset, ext_strings, ext_str_hash)
|
|||
sym->ecoff_symbol->ecoff_sym.asym.index = indexNil;
|
||||
}
|
||||
|
||||
sym->ecoff_symbol->ecoff_sym.asym.iss =
|
||||
add_string (ext_strings, ext_str_hash, S_GET_NAME (sym),
|
||||
(shash_t **) NULL);
|
||||
if (*bufend - ext_out < external_ext_size)
|
||||
ext_out = ecoff_add_bytes (buf, bufend, ext_out, external_ext_size);
|
||||
(*swap_ext_out) (stdoutput, &sym->ecoff_symbol->ecoff_sym, ext_out);
|
||||
#ifdef obj_set_sym_index
|
||||
obj_set_sym_index (as_sym->bsym, iext);
|
||||
#endif
|
||||
ext_out += external_ext_size;
|
||||
++iext;
|
||||
obj_ecoff_set_ext (sym, &sym->ecoff_symbol->ecoff_sym);
|
||||
}
|
||||
|
||||
return offset + iext * external_ext_size;
|
||||
}
|
||||
|
||||
/* Build the ECOFF dbeugging information. */
|
||||
|
@ -4379,12 +4371,6 @@ ecoff_build_debug (hdr, bufp, backend)
|
|||
char *buf;
|
||||
char *bufend;
|
||||
unsigned long offset;
|
||||
char *extbuf;
|
||||
char *extbufend;
|
||||
unsigned long extoffset;
|
||||
varray_t ext_strings;
|
||||
static varray_t init_ext_strings = INIT_VARRAY (char);
|
||||
struct hash_control *ext_str_hash;
|
||||
|
||||
/* Make sure we have a file. */
|
||||
if (first_file == (efdr_t *) NULL)
|
||||
|
@ -4497,24 +4483,6 @@ ecoff_build_debug (hdr, bufp, backend)
|
|||
offset = ecoff_build_ss (backend, &buf, &bufend, offset);
|
||||
hdr->issMax = offset - hdr->cbSsOffset;
|
||||
|
||||
/* Build the external symbols and external strings. We build these
|
||||
now because we want to copy out the external strings now. We
|
||||
copy out the external symbol information down below. */
|
||||
extbuf = xmalloc (PAGE_SIZE);
|
||||
extbufend = extbuf + PAGE_SIZE;
|
||||
ext_strings = init_ext_strings;
|
||||
ext_str_hash = hash_new ();
|
||||
extoffset = ecoff_build_ext (backend, &extbuf, &extbufend,
|
||||
(unsigned long) 0, &ext_strings,
|
||||
ext_str_hash);
|
||||
|
||||
/* Copy out the external strings. */
|
||||
hdr->cbSsExtOffset = offset;
|
||||
offset += ecoff_build_strings (&buf, &bufend, offset, &ext_strings);
|
||||
offset = ecoff_padding_adjust (backend, &buf, &bufend, offset,
|
||||
(char **) NULL);
|
||||
hdr->issExtMax = offset - hdr->cbSsExtOffset;
|
||||
|
||||
/* We don't use relative file descriptors. */
|
||||
hdr->crfd = 0;
|
||||
hdr->cbRfdOffset = 0;
|
||||
|
@ -4524,13 +4492,13 @@ ecoff_build_debug (hdr, bufp, backend)
|
|||
offset = ecoff_build_fdr (backend, &buf, &bufend, offset);
|
||||
hdr->ifdMax = (offset - hdr->cbFdOffset) / backend->external_fdr_size;
|
||||
|
||||
/* Copy out the external symbols. */
|
||||
hdr->cbExtOffset = offset;
|
||||
if (bufend - (buf + offset) < extoffset)
|
||||
(void) ecoff_add_bytes (&buf, &bufend, buf + offset, extoffset);
|
||||
memcpy (buf + offset, extbuf, extoffset);
|
||||
offset += extoffset;
|
||||
hdr->iextMax = (offset - hdr->cbExtOffset) / backend->external_ext_size;
|
||||
/* Set up the external symbols, which are handled by the BFD back
|
||||
end. */
|
||||
hdr->issExtMax = 0;
|
||||
hdr->cbSsExtOffset = 0;
|
||||
hdr->iextMax = 0;
|
||||
hdr->cbExtOffset = 0;
|
||||
ecoff_setup_ext ();
|
||||
|
||||
know ((offset & (backend->debug_align - 1)) == 0);
|
||||
|
||||
|
@ -4931,4 +4899,20 @@ allocate_lineno_list ()
|
|||
return ptr;
|
||||
}
|
||||
|
||||
ecoff_set_gp_prolog_size (sz)
|
||||
int sz;
|
||||
{
|
||||
if (cur_proc_ptr == 0)
|
||||
abort ();
|
||||
|
||||
cur_proc_ptr->pdr.gp_prologue = sz;
|
||||
if (cur_proc_ptr->pdr.gp_prologue != sz)
|
||||
{
|
||||
as_warn ("GP prologue size exceeds field size, using 0 instead");
|
||||
cur_proc_ptr->pdr.gp_prologue = 0;
|
||||
}
|
||||
|
||||
cur_proc_ptr->pdr.gp_used = 1;
|
||||
}
|
||||
|
||||
#endif /* ECOFF_DEBUGGING */
|
||||
|
|
Loading…
Reference in New Issue