void
ecoff_swap_tir_in (bigend, ext_copy, intern)
int bigend;
- struct tir_ext *ext_copy;
+ const struct tir_ext *ext_copy;
TIR *intern;
{
struct tir_ext ext[1];
void
ecoff_swap_tir_out (bigend, intern_copy, ext)
int bigend;
- TIR *intern_copy;
+ const TIR *intern_copy;
struct tir_ext *ext;
{
TIR intern[1];
void
ecoff_swap_rndx_in (bigend, ext_copy, intern)
int bigend;
- struct rndx_ext *ext_copy;
+ const struct rndx_ext *ext_copy;
RNDXR *intern;
{
struct rndx_ext ext[1];
void
ecoff_swap_rndx_out (bigend, intern_copy, ext)
int bigend;
- RNDXR *intern_copy;
+ const RNDXR *intern_copy;
struct rndx_ext *ext;
{
RNDXR intern[1];
}
/* Read in and swap the important symbolic information for an ECOFF
- object file. This is called by gdb. */
+ object file. This is called by gdb via the read_debug_info entry
+ point in the backend structure. */
+/*ARGSUSED*/
boolean
-ecoff_slurp_symbolic_info (abfd)
+ecoff_slurp_symbolic_info (abfd, ignore, debug)
bfd *abfd;
+ asection *ignore;
+ struct ecoff_debug_info *debug;
{
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
HDRR *internal_symhdr;
bfd_size_type raw_end;
bfd_size_type cb_end;
+ BFD_ASSERT (debug == &ecoff_data (abfd)->debug_info);
+
/* Check whether we've already gotten it, and whether there's any to
get. */
if (ecoff_data (abfd)->raw_syments != (PTR) NULL)
if (! ecoff_slurp_symbolic_header (abfd))
return false;
- internal_symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
+ internal_symhdr = &debug->symbolic_header;
/* Read all the symbolic information at once. */
raw_base = (ecoff_data (abfd)->sym_filepos
/* Get pointers for the numeric offsets in the HDRR structure. */
#define FIX(off1, off2, type) \
if (internal_symhdr->off1 == 0) \
- ecoff_data (abfd)->debug_info.off2 = (type) NULL; \
+ debug->off2 = (type) NULL; \
else \
- ecoff_data (abfd)->debug_info.off2 = (type) ((char *) raw \
- + internal_symhdr->off1 \
- - raw_base)
+ debug->off2 = (type) ((char *) raw \
+ + internal_symhdr->off1 \
+ - raw_base)
FIX (cbLineOffset, line, unsigned char *);
FIX (cbDnOffset, external_dnr, PTR);
FIX (cbPdOffset, external_pdr, PTR);
We need to look at the fdr to deal with a lot of information in
the symbols, so we swap them here. */
- ecoff_data (abfd)->debug_info.fdr =
- (struct fdr *) bfd_alloc (abfd,
- (internal_symhdr->ifdMax *
- sizeof (struct fdr)));
- if (ecoff_data (abfd)->debug_info.fdr == NULL)
+ debug->fdr = (struct fdr *) bfd_alloc (abfd,
+ (internal_symhdr->ifdMax *
+ sizeof (struct fdr)));
+ if (debug->fdr == NULL)
{
bfd_set_error (bfd_error_no_memory);
return false;
}
external_fdr_size = backend->debug_swap.external_fdr_size;
- fdr_ptr = ecoff_data (abfd)->debug_info.fdr;
- fraw_src = (char *) ecoff_data (abfd)->debug_info.external_fdr;
+ fdr_ptr = debug->fdr;
+ fraw_src = (char *) debug->external_fdr;
fraw_end = fraw_src + internal_symhdr->ifdMax * external_fdr_size;
for (; fraw_src < fraw_end; fraw_src += external_fdr_size, fdr_ptr++)
(*backend->debug_swap.swap_fdr_in) (abfd, (PTR) fraw_src, fdr_ptr);
return true;
/* Get the symbolic information. */
- if (ecoff_slurp_symbolic_info (abfd) == false)
+ if (! ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
+ &ecoff_data (abfd)->debug_info))
return false;
if (bfd_get_symcount (abfd) == 0)
return true;
ecoff_get_symtab_upper_bound (abfd)
bfd *abfd;
{
- if (! ecoff_slurp_symbolic_info (abfd))
+ if (! ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
+ &ecoff_data (abfd)->debug_info))
return -1;
if (bfd_get_symcount (abfd) == 0)
return false;
/* Make sure we have the FDR's. */
- if (ecoff_slurp_symbolic_info (abfd) == false
+ if (! ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
+ &ecoff_data (abfd)->debug_info)
|| bfd_get_symcount (abfd) == 0)
return false;
goto error_return;
/* Build the external symbol information. This must be done before
- writing out the relocs so that we know the symbol indices. The
- condition checks makes sure this object was not created by
- ecoff_bfd_final_link, since if it was we do not want to tamper
- with the external symbols. */
- if (bfd_get_outsymbols (abfd) != (asymbol **) NULL)
+ writing out the relocs so that we know the symbol indices. We
+ don't do this if this BFD was created by the backend linker,
+ since it will have already handled the symbols and relocs. */
+ if (! ecoff_data (abfd)->linker)
{
symhdr->iextMax = 0;
symhdr->issExtMax = 0;
/* Set local fields. */
ret->indx = -1;
ret->abfd = NULL;
+ ret->written = 0;
+ ret->small = 0;
}
memset ((PTR) &ret->esym, 0, sizeof ret->esym);
h->abfd = abfd;
h->esym = esym;
}
+
+ /* Remember whether this symbol was small undefined. */
+ if (esym.asym.sc == scSUndefined)
+ h->small = 1;
+
+ /* If this symbol was ever small undefined, it needs to wind
+ up in a GP relative section. We can't control the
+ section of a defined symbol, but we can control the
+ section of a common symbol. This case is actually needed
+ on Ultrix 4.2 to handle the symbol cred in -lckrb. */
+ if (h->small
+ && h->root.type == bfd_link_hash_common
+ && strcmp (h->root.u.c.section->name, SCOMMON) != 0)
+ {
+ h->root.u.c.section = bfd_make_section_old_way (abfd, SCOMMON);
+ h->root.u.c.section->flags = SEC_ALLOC;
+ if (h->esym.asym.sc == scCommon)
+ h->esym.asym.sc = scSCommon;
+ }
}
}
bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax;
+ ecoff_data (abfd)->linker = true;
+
return true;
}
/* FIXME: We should check if this symbol is being stripped. */
- if (h->root.written)
+ if (h->written)
return true;
if (h->abfd == (bfd *) NULL)
/* bfd_ecoff_debug_one_external uses iextMax to keep track of the
symbol number. */
h->indx = ecoff_data (output_bfd)->debug_info.symbolic_header.iextMax;
- h->root.written = true;
+ h->written = 1;
return (bfd_ecoff_debug_one_external
(output_bfd, &ecoff_data (output_bfd)->debug_info,