/* Generic ECOFF (Extended-COFF) routines.
- Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+ 2002, 2003 Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
\f
/* Prototypes for static functions. */
-static int ecoff_get_magic PARAMS ((bfd *));
-static long ecoff_sec_to_styp_flags PARAMS ((const char *, flagword));
-static boolean ecoff_slurp_symbolic_header PARAMS ((bfd *));
-static boolean ecoff_set_symbol_info PARAMS ((bfd *, SYMR *, asymbol *, int, int));
-static void ecoff_emit_aggregate PARAMS ((bfd *, FDR *, char *, RNDXR *, long, const char *));
-static char *ecoff_type_to_string PARAMS ((bfd *, FDR *, unsigned int));
-static boolean ecoff_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **));
-static int ecoff_sort_hdrs PARAMS ((const PTR, const PTR));
-static boolean ecoff_compute_section_file_positions PARAMS ((bfd *));
-static bfd_size_type ecoff_compute_reloc_file_positions PARAMS ((bfd *));
-static boolean ecoff_get_extr PARAMS ((asymbol *, EXTR *));
-static void ecoff_set_index PARAMS ((asymbol *, bfd_size_type));
-static unsigned int ecoff_armap_hash PARAMS ((const char *, unsigned int *, unsigned int, unsigned int));
+static int ecoff_get_magic
+ PARAMS ((bfd *));
+static long ecoff_sec_to_styp_flags
+ PARAMS ((const char *, flagword));
+static bfd_boolean ecoff_slurp_symbolic_header
+ PARAMS ((bfd *));
+static bfd_boolean ecoff_set_symbol_info
+ PARAMS ((bfd *, SYMR *, asymbol *, int, int));
+static void ecoff_emit_aggregate
+ PARAMS ((bfd *, FDR *, char *, RNDXR *, long, const char *));
+static char *ecoff_type_to_string
+ PARAMS ((bfd *, FDR *, unsigned int));
+static bfd_boolean ecoff_slurp_reloc_table
+ PARAMS ((bfd *, asection *, asymbol **));
+static int ecoff_sort_hdrs
+ PARAMS ((const PTR, const PTR));
+static bfd_boolean ecoff_compute_section_file_positions
+ PARAMS ((bfd *));
+static bfd_size_type ecoff_compute_reloc_file_positions
+ PARAMS ((bfd *));
+static bfd_boolean ecoff_get_extr
+ PARAMS ((asymbol *, EXTR *));
+static void ecoff_set_index
+ PARAMS ((asymbol *, bfd_size_type));
+static unsigned int ecoff_armap_hash
+ PARAMS ((const char *, unsigned int *, unsigned int, unsigned int));
\f
/* This stuff is somewhat copied from coffcode.h. */
"*DEBUG*", 0, 0, NULL, 0, 0, 0,
/* linker_mark, linker_has_input, gc_mark, segment_mark, */
0, 0, 0, 0,
+ /* sec_info_type, use_rela_p, has_tls_reloc, */
+ 0, 0, 0,
+ /* need_finalize_relax, has_gp_reloc, */
+ 0, 0,
+ /* flag13, flag14, flag15, flag16, flag20, flag24, */
+ 0, 0, 0, 0, 0, 0,
/* vma, lma, _cooked_size, _raw_size, */
0, 0, 0, 0,
/* output_offset, output_section, alignment_power, */
NULL, NULL, 0, 0, 0,
/* line_filepos, userdata, contents, lineno, lineno_count, */
0, NULL, NULL, NULL, 0,
- /* entsize, comdat, moving_line_filepos, */
- 0, NULL, 0,
+ /* entsize, comdat, kept_section, moving_line_filepos, */
+ 0, NULL, NULL, 0,
/* target_index, used_by_bfd, constructor_chain, owner, */
0, NULL, NULL, NULL,
/* symbol, */
/* Create an ECOFF object. */
-boolean
+bfd_boolean
_bfd_ecoff_mkobject (abfd)
bfd *abfd;
{
abfd->tdata.ecoff_obj_data = (struct ecoff_tdata *) bfd_zalloc (abfd, amt);
if (abfd->tdata.ecoff_obj_data == NULL)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* This is a hook called by coff_real_object_p to create any backend
/* Initialize a new section. */
-boolean
+bfd_boolean
_bfd_ecoff_new_section_hook (abfd, section)
bfd *abfd ATTRIBUTE_UNUSED;
asection *section;
uncertain about .init on some systems and I don't know how shared
libraries work. */
- return true;
+ return TRUE;
}
/* Determine the machine architecture and type. This is called from
below. This could be an ECOFF backend routine, with one version
for each target, but there aren't all that many ECOFF targets. */
-boolean
+bfd_boolean
_bfd_ecoff_set_arch_mach_hook (abfd, filehdr)
bfd *abfd;
PTR filehdr;
/* Get the BFD flags to use for a section. */
-boolean
+bfd_boolean
_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section, flags_ptr)
bfd *abfd ATTRIBUTE_UNUSED;
PTR hdr;
sec_flags |= SEC_ALLOC | SEC_LOAD;
* flags_ptr = sec_flags;
- return true;
+ return TRUE;
}
\f
/* Read in the symbolic header for an ECOFF object file. */
-static boolean
+static bfd_boolean
ecoff_slurp_symbolic_header (abfd)
bfd *abfd;
{
/* See if we've already read it in. */
if (ecoff_data (abfd)->debug_info.symbolic_header.magic ==
backend->debug_swap.sym_magic)
- return true;
+ return TRUE;
/* See whether there is a symbolic header. */
if (ecoff_data (abfd)->sym_filepos == 0)
{
bfd_get_symcount (abfd) = 0;
- return true;
+ return TRUE;
}
/* At this point bfd_get_symcount (abfd) holds the number of symbols
if (bfd_get_symcount (abfd) != external_hdr_size)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
/* Read the symbolic information header. */
if (raw != NULL)
free (raw);
- return true;
+ return TRUE;
error_return:
if (raw != NULL)
free (raw);
- return false;
+ return FALSE;
}
/* Read in and swap the important symbolic information for an ECOFF
object file. This is called by gdb via the read_debug_info entry
point in the backend structure. */
-boolean
+bfd_boolean
_bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
bfd *abfd;
asection *ignore ATTRIBUTE_UNUSED;
/* Check whether we've already gotten it, and whether there's any to
get. */
if (ecoff_data (abfd)->raw_syments != (PTR) NULL)
- return true;
+ return TRUE;
if (ecoff_data (abfd)->sym_filepos == 0)
{
bfd_get_symcount (abfd) = 0;
- return true;
+ return TRUE;
}
if (! ecoff_slurp_symbolic_header (abfd))
- return false;
+ return FALSE;
internal_symhdr = &debug->symbolic_header;
if (raw_size == 0)
{
ecoff_data (abfd)->sym_filepos = 0;
- return true;
+ return TRUE;
}
raw = (PTR) bfd_alloc (abfd, raw_size);
if (raw == NULL)
- return false;
+ return FALSE;
pos = ecoff_data (abfd)->sym_filepos;
pos += backend->debug_swap.external_hdr_size;
|| bfd_bread (raw, raw_size, abfd) != raw_size)
{
bfd_release (abfd, raw);
- return false;
+ return FALSE;
}
ecoff_data (abfd)->raw_syments = raw;
amt *= sizeof (struct fdr);
debug->fdr = (struct fdr *) bfd_alloc (abfd, amt);
if (debug->fdr == NULL)
- return false;
+ return FALSE;
external_fdr_size = backend->debug_swap.external_fdr_size;
fdr_ptr = debug->fdr;
fraw_src = (char *) debug->external_fdr;
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;
+ return TRUE;
}
\f
/* ECOFF symbol table routines. The ECOFF symbol table is described
return (asymbol *) NULL;
new->symbol.section = (asection *) NULL;
new->fdr = (FDR *) NULL;
- new->local = false;
+ new->local = FALSE;
new->native = NULL;
new->symbol.the_bfd = abfd;
return &new->symbol;
/* Set the BFD flags and section for an ECOFF symbol. */
-static boolean
+static bfd_boolean
ecoff_set_symbol_info (abfd, ecoff_sym, asym, ext, weak)
bfd *abfd;
SYMR *ecoff_sym;
if (ECOFF_IS_STAB (ecoff_sym))
{
asym->flags = BSF_DEBUGGING;
- return true;
+ return TRUE;
}
break;
default:
asym->flags = BSF_DEBUGGING;
- return true;
+ return TRUE;
}
if (weak)
amt = strlen (name) + 1;
copy = (char *) bfd_alloc (abfd, amt);
if (!copy)
- return false;
+ return FALSE;
strcpy (copy, name);
section = bfd_make_section (abfd, copy);
}
amt = sizeof (arelent_chain);
reloc_chain = (arelent_chain *) bfd_alloc (abfd, amt);
if (!reloc_chain)
- return false;
+ return FALSE;
reloc_chain->relent.sym_ptr_ptr =
bfd_get_section (asym)->symbol_ptr_ptr;
reloc_chain->relent.address = section->_raw_size;
break;
}
}
- return true;
+ return TRUE;
}
/* Read an ECOFF symbol table. */
-boolean
+bfd_boolean
_bfd_ecoff_slurp_symbol_table (abfd)
bfd *abfd;
{
/* If we've already read in the symbol table, do nothing. */
if (ecoff_data (abfd)->canonical_symbols != NULL)
- return true;
+ return TRUE;
/* Get the symbolic information. */
if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL,
&ecoff_data (abfd)->debug_info))
- return false;
+ return FALSE;
if (bfd_get_symcount (abfd) == 0)
- return true;
+ return TRUE;
internal_size = bfd_get_symcount (abfd);
internal_size *= sizeof (ecoff_symbol_type);
internal = (ecoff_symbol_type *) bfd_alloc (abfd, internal_size);
if (internal == NULL)
- return false;
+ return FALSE;
internal_ptr = internal;
eraw_src = (char *) ecoff_data (abfd)->debug_info.external_ext;
if (!ecoff_set_symbol_info (abfd, &internal_esym.asym,
&internal_ptr->symbol, 1,
internal_esym.weakext))
- return false;
+ return FALSE;
/* The alpha uses a negative ifd field for section symbols. */
if (internal_esym.ifd >= 0)
internal_ptr->fdr = (ecoff_data (abfd)->debug_info.fdr
+ internal_esym.ifd);
else
internal_ptr->fdr = NULL;
- internal_ptr->local = false;
+ internal_ptr->local = FALSE;
internal_ptr->native = (PTR) eraw_src;
}
+ internal_sym.iss);
if (!ecoff_set_symbol_info (abfd, &internal_sym,
&internal_ptr->symbol, 0, 0))
- return false;
+ return FALSE;
internal_ptr->fdr = fdr_ptr;
- internal_ptr->local = true;
+ internal_ptr->local = TRUE;
internal_ptr->native = (PTR) lraw_src;
}
}
ecoff_data (abfd)->canonical_symbols = internal;
- return true;
+ return TRUE;
}
/* Return the amount of space needed for the canonical symbols. */
/* Return whether this is a local label. */
-boolean
+bfd_boolean
_bfd_ecoff_bfd_is_local_label_name (abfd, name)
bfd *abfd ATTRIBUTE_UNUSED;
const char *name;
\f
/* Read in the relocs for a section. */
-static boolean
+static bfd_boolean
ecoff_slurp_reloc_table (abfd, section, symbols)
bfd *abfd;
asection *section;
if (section->relocation != (arelent *) NULL
|| section->reloc_count == 0
|| (section->flags & SEC_CONSTRUCTOR) != 0)
- return true;
+ return TRUE;
if (! _bfd_ecoff_slurp_symbol_table (abfd))
- return false;
+ return FALSE;
amt = section->reloc_count;
amt *= sizeof (arelent);
external_relocs = (char *) bfd_alloc (abfd, amt);
if (internal_relocs == (arelent *) NULL
|| external_relocs == (char *) NULL)
- return false;
+ return FALSE;
if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0)
- return false;
+ return FALSE;
if (bfd_bread (external_relocs, amt, abfd) != amt)
- return false;
+ return FALSE;
for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++)
{
section->relocation = internal_relocs;
- return true;
+ return TRUE;
}
/* Get a canonical list of relocs. */
and return the name of the source file and the line nearest to the
wanted location. */
-boolean
+bfd_boolean
_bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
filename_ptr, functionname_ptr, retline_ptr)
bfd *abfd;
/* Make sure we have the FDR's. */
if (! _bfd_ecoff_slurp_symbolic_info (abfd, (asection *) NULL, debug_info)
|| bfd_get_symcount (abfd) == 0)
- return false;
+ return FALSE;
if (ecoff_data (abfd)->find_line_info == NULL)
{
ecoff_data (abfd)->find_line_info
= (struct ecoff_find_line *) bfd_zalloc (abfd, amt);
if (ecoff_data (abfd)->find_line_info == NULL)
- return false;
+ return FALSE;
}
line_info = ecoff_data (abfd)->find_line_info;
the symbol table, so this function only handles the other debugging
information. */
-boolean
+bfd_boolean
_bfd_ecoff_bfd_copy_private_bfd_data (ibfd, obfd)
bfd *ibfd;
bfd *obfd;
register int i;
asymbol **sym_ptr_ptr;
size_t c;
- boolean local;
+ bfd_boolean local;
/* We only want to copy information over if both BFD's use ECOFF
format. */
if (bfd_get_flavour (ibfd) != bfd_target_ecoff_flavour
|| bfd_get_flavour (obfd) != bfd_target_ecoff_flavour)
- return true;
+ return TRUE;
/* Copy the GP value and the register masks. */
ecoff_data (obfd)->gp = ecoff_data (ibfd)->gp;
c = bfd_get_symcount (obfd);
sym_ptr_ptr = bfd_get_outsymbols (obfd);
if (c == 0 || sym_ptr_ptr == (asymbol **) NULL)
- return true;
+ return TRUE;
/* See if there are any local symbols. */
- local = false;
+ local = FALSE;
for (; c > 0; c--, sym_ptr_ptr++)
{
if (ecoffsymbol (*sym_ptr_ptr)->local)
{
- local = true;
+ local = TRUE;
break;
}
}
}
}
- return true;
+ return TRUE;
}
\f
/* Set the architecture. The supported architecture is stored in the
backend pointer. We always set the architecture anyhow, since many
callers ignore the return value. */
-boolean
+bfd_boolean
_bfd_ecoff_set_arch_mach (abfd, arch, machine)
bfd *abfd;
enum bfd_architecture arch;
int
_bfd_ecoff_sizeof_headers (abfd, reloc)
bfd *abfd;
- boolean reloc ATTRIBUTE_UNUSED;
+ bfd_boolean reloc ATTRIBUTE_UNUSED;
{
asection *current;
int c;
/* Get the contents of a section. */
-boolean
+bfd_boolean
_bfd_ecoff_get_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
/* Calculate the file position for each section, and set
reloc_filepos. */
-static boolean
+static bfd_boolean
ecoff_compute_section_file_positions (abfd)
bfd *abfd;
{
asection *current;
unsigned int i;
file_ptr old_sofar;
- boolean rdata_in_text;
- boolean first_data, first_nonalloc;
+ bfd_boolean rdata_in_text;
+ bfd_boolean first_data, first_nonalloc;
const bfd_vma round = ecoff_backend (abfd)->round;
bfd_size_type amt;
- sofar = _bfd_ecoff_sizeof_headers (abfd, false);
+ sofar = _bfd_ecoff_sizeof_headers (abfd, FALSE);
file_sofar = sofar;
/* Sort the sections by VMA. */
amt *= sizeof (asection *);
sorted_hdrs = (asection **) bfd_malloc (amt);
if (sorted_hdrs == NULL)
- return false;
+ return FALSE;
for (current = abfd->sections, i = 0;
current != NULL;
current = current->next, i++)
&& strcmp (current->name, _PDATA) != 0
&& strcmp (current->name, _RCONST) != 0)
{
- rdata_in_text = false;
+ rdata_in_text = FALSE;
break;
}
}
}
ecoff_data (abfd)->rdata_in_text = rdata_in_text;
- first_data = true;
- first_nonalloc = true;
+ first_data = TRUE;
+ first_nonalloc = TRUE;
for (i = 0; i < abfd->section_count; i++)
{
unsigned int alignment_power;
{
sofar = (sofar + round - 1) &~ (round - 1);
file_sofar = (file_sofar + round - 1) &~ (round - 1);
- first_data = false;
+ first_data = FALSE;
}
else if (strcmp (current->name, _LIB) == 0)
{
/* Skip up to the next page for an unallocated section, such
as the .comment section on the Alpha. This leaves room
for the .bss section. */
- first_nonalloc = false;
+ first_nonalloc = FALSE;
sofar = (sofar + round - 1) &~ (round - 1);
file_sofar = (file_sofar + round - 1) &~ (round - 1);
}
ecoff_data (abfd)->reloc_filepos = file_sofar;
- return true;
+ return TRUE;
}
/* Determine the location of the relocs for all the sections in the
{
if (! ecoff_compute_section_file_positions (abfd))
abort ();
- abfd->output_has_begun = true;
+ abfd->output_has_begun = TRUE;
}
reloc_base = ecoff_data (abfd)->reloc_filepos;
/* Set the contents of a section. */
-boolean
+bfd_boolean
_bfd_ecoff_set_section_contents (abfd, section, location, offset, count)
bfd *abfd;
asection *section;
file_ptr pos;
/* This must be done first, because bfd_set_section_contents is
- going to set output_has_begun to true. */
+ going to set output_has_begun to TRUE. */
if (! abfd->output_has_begun)
{
if (! ecoff_compute_section_file_positions (abfd))
- return false;
+ return FALSE;
}
/* Handle the .lib section specially so that Irix 4 shared libraries
}
if (count == 0)
- return true;
+ return TRUE;
pos = section->filepos + offset;
if (bfd_seek (abfd, pos, SEEK_SET) != 0
|| bfd_bwrite (location, count, abfd) != count)
- return false;
+ return FALSE;
- return true;
+ return TRUE;
}
/* Get the GP value for an ECOFF file. This is a hook used by
/* Set the GP value for an ECOFF file. This is a hook used by the
assembler. */
-boolean
+bfd_boolean
bfd_ecoff_set_gp_value (abfd, gp_value)
bfd *abfd;
bfd_vma gp_value;
|| bfd_get_format (abfd) != bfd_object)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
ecoff_data (abfd)->gp = gp_value;
- return true;
+ return TRUE;
}
/* Set the register masks for an ECOFF file. This is a hook used by
the assembler. */
-boolean
+bfd_boolean
bfd_ecoff_set_regmasks (abfd, gprmask, fprmask, cprmask)
bfd *abfd;
unsigned long gprmask;
|| bfd_get_format (abfd) != bfd_object)
{
bfd_set_error (bfd_error_invalid_operation);
- return false;
+ return FALSE;
}
tdata = ecoff_data (abfd);
tdata->cprmask[i] = cprmask[i];
}
- return true;
+ return TRUE;
}
/* Get ECOFF EXTR information for an external symbol. This function
is passed to bfd_ecoff_debug_externals. */
-static boolean
+static bfd_boolean
ecoff_get_extr (sym, esym)
asymbol *sym;
EXTR *esym;
if ((sym->flags & BSF_DEBUGGING) != 0
|| (sym->flags & BSF_LOCAL) != 0
|| (sym->flags & BSF_SECTION_SYM) != 0)
- return false;
+ return FALSE;
esym->jmptbl = 0;
esym->cobol_main = 0;
esym->asym.sc = scAbs;
esym->asym.reserved = 0;
esym->asym.index = indexNil;
- return true;
+ return TRUE;
}
ecoff_sym_ptr = ecoffsymbol (sym);
if (ecoff_sym_ptr->local)
- return false;
+ return FALSE;
input_bfd = bfd_asymbol_bfd (sym);
(*(ecoff_backend (input_bfd)->debug_swap.swap_ext_in))
esym->ifd = input_debug->ifdmap[esym->ifd];
}
- return true;
+ return TRUE;
}
/* Set the external symbol index. This routine is passed to
/* Write out an ECOFF file. */
-boolean
+bfd_boolean
_bfd_ecoff_write_object_contents (abfd)
bfd *abfd;
{
const bfd_size_type external_hdr_size
= backend->debug_swap.external_hdr_size;
const bfd_size_type external_reloc_size = backend->external_reloc_size;
- void (* const adjust_reloc_out) PARAMS ((bfd *,
- const arelent *,
- struct internal_reloc *))
+ void (* const adjust_reloc_out)
+ PARAMS ((bfd *, const arelent *, struct internal_reloc *))
= backend->adjust_reloc_out;
- void (* const swap_reloc_out) PARAMS ((bfd *,
- const struct internal_reloc *,
- PTR))
+ void (* const swap_reloc_out)
+ PARAMS ((bfd *, const struct internal_reloc *, PTR))
= backend->swap_reloc_out;
struct ecoff_debug_info * const debug = &ecoff_data (abfd)->debug_info;
HDRR * const symhdr = &debug->symbolic_header;
bfd_size_type reloc_size;
bfd_size_type text_size;
bfd_vma text_start;
- boolean set_text_start;
+ bfd_boolean set_text_start;
bfd_size_type data_size;
bfd_vma data_start;
- boolean set_data_start;
+ bfd_boolean set_data_start;
bfd_size_type bss_size;
PTR buff = NULL;
PTR reloc_buff = NULL;
}
if ((abfd->flags & D_PAGED) != 0)
- text_size = _bfd_ecoff_sizeof_headers (abfd, false);
+ text_size = _bfd_ecoff_sizeof_headers (abfd, FALSE);
else
text_size = 0;
text_start = 0;
- set_text_start = false;
+ set_text_start = FALSE;
data_size = 0;
data_start = 0;
- set_data_start = false;
+ set_data_start = FALSE;
bss_size = 0;
/* Write section headers to the file. */
if (! set_text_start || text_start > vma)
{
text_start = vma;
- set_text_start = true;
+ set_text_start = TRUE;
}
}
else if ((section.s_flags & STYP_RDATA) != 0
if (! set_data_start || data_start > vma)
{
data_start = vma;
- set_data_start = true;
+ set_data_start = TRUE;
}
}
else if ((section.s_flags & STYP_BSS) != 0
bfd_release (abfd, reloc_buff);
if (buff != NULL)
free (buff);
- return true;
+ return TRUE;
error_return:
if (reloc_buff != NULL)
bfd_release (abfd, reloc_buff);
if (buff != NULL)
free (buff);
- return false;
+ return FALSE;
}
\f
/* Archive handling. ECOFF uses what appears to be a unique type of
/* Read in the armap. */
-boolean
+bfd_boolean
_bfd_ecoff_slurp_armap (abfd)
bfd *abfd;
{
/* Get the name of the first element. */
i = bfd_bread ((PTR) nextname, (bfd_size_type) 16, abfd);
if (i == 0)
- return true;
+ return TRUE;
if (i != 16)
- return false;
+ return FALSE;
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
- return false;
+ return FALSE;
/* Irix 4.0.5F apparently can use either an ECOFF armap or a
standard COFF armap. We could move the ECOFF armap stuff into
|| strncmp (nextname + ARMAP_END_INDEX,
ARMAP_END, sizeof ARMAP_END - 1) != 0)
{
- bfd_has_map (abfd) = false;
- return true;
+ bfd_has_map (abfd) = FALSE;
+ return TRUE;
}
/* Make sure we have the right byte ordering. */
^ (bfd_big_endian (abfd))))
{
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
/* Read in the armap. */
ardata = bfd_ardata (abfd);
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == (struct areltdata *) NULL)
- return false;
+ return FALSE;
parsed_size = mapdata->parsed_size;
bfd_release (abfd, (PTR) mapdata);
raw_armap = (char *) bfd_alloc (abfd, parsed_size);
if (raw_armap == (char *) NULL)
- return false;
+ return FALSE;
if (bfd_bread ((PTR) raw_armap, parsed_size, abfd) != parsed_size)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
bfd_release (abfd, (PTR) raw_armap);
- return false;
+ return FALSE;
}
ardata->tdata = (PTR) raw_armap;
amt *= sizeof (struct symdef);
symdef_ptr = (struct symdef *) bfd_alloc (abfd, amt);
if (!symdef_ptr)
- return false;
+ return FALSE;
ardata->symdefs = (carsym *) symdef_ptr;
/* Pad to an even boundary. */
ardata->first_file_filepos += ardata->first_file_filepos % 2;
- bfd_has_map (abfd) = true;
+ bfd_has_map (abfd) = TRUE;
- return true;
+ return TRUE;
}
/* Write out an armap. */
-boolean
+bfd_boolean
_bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
bfd *abfd;
unsigned int elength;
if (bfd_bwrite ((PTR) &hdr, (bfd_size_type) sizeof (struct ar_hdr), abfd)
!= sizeof (struct ar_hdr))
- return false;
+ return FALSE;
H_PUT_32 (abfd, hashsize, temp);
if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
- return false;
+ return FALSE;
hashtable = (bfd_byte *) bfd_zalloc (abfd, symdefsize);
if (!hashtable)
- return false;
+ return FALSE;
current = abfd->archive_head;
last_elt = current;
}
if (bfd_bwrite ((PTR) hashtable, symdefsize, abfd) != symdefsize)
- return false;
+ return FALSE;
bfd_release (abfd, hashtable);
/* Now write the strings. */
H_PUT_32 (abfd, stringsize, temp);
if (bfd_bwrite ((PTR) temp, (bfd_size_type) 4, abfd) != 4)
- return false;
+ return FALSE;
for (i = 0; i < orl_count; i++)
{
bfd_size_type len;
len = strlen (*map[i].name) + 1;
if (bfd_bwrite ((PTR) (*map[i].name), len, abfd) != len)
- return false;
+ return FALSE;
}
/* The spec sez this should be a newline. But in order to be
if (padit)
{
if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1)
- return false;
+ return FALSE;
}
- return true;
+ return TRUE;
}
/* See whether this BFD is an archive. If it is, read in the armap
first = bfd_openr_next_archived_file (abfd, (bfd *) NULL);
if (first != NULL)
{
- first->target_defaulted = false;
+ first->target_defaulted = FALSE;
if (bfd_check_format (first, bfd_object)
&& first->xvec != abfd->xvec)
{
PARAMS ((struct bfd_hash_entry *entry,
struct bfd_hash_table *table,
const char *string));
-static boolean ecoff_link_add_archive_symbols
+static bfd_boolean ecoff_link_add_archive_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean ecoff_link_check_archive_element
- PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded));
-static boolean ecoff_link_add_object_symbols
+static bfd_boolean ecoff_link_check_archive_element
+ PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded));
+static bfd_boolean ecoff_link_add_object_symbols
PARAMS ((bfd *, struct bfd_link_info *));
-static boolean ecoff_link_add_externals
+static bfd_boolean ecoff_link_add_externals
PARAMS ((bfd *, struct bfd_link_info *, PTR, char *));
/* Routine to create an entry in an ECOFF link hash table. */
#define ecoff_link_hash_traverse(table, func, info) \
(bfd_link_hash_traverse \
(&(table)->root, \
- (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
+ (bfd_boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func), \
(info)))
/* Get the ECOFF link hash table from the info structure. This is
/* Given an ECOFF BFD, add symbols to the global hash table as
appropriate. */
-boolean
+bfd_boolean
_bfd_ecoff_bfd_link_add_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
return ecoff_link_add_archive_symbols (abfd, info);
default:
bfd_set_error (bfd_error_wrong_format);
- return false;
+ return FALSE;
}
}
already have a hash table, so there is no reason to construct
another one. */
-static boolean
+static bfd_boolean
ecoff_link_add_archive_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
{
/* An empty archive is a special case. */
if (bfd_openr_next_archived_file (abfd, (bfd *) NULL) == NULL)
- return true;
+ return TRUE;
bfd_set_error (bfd_error_no_armap);
- return false;
+ return FALSE;
}
/* If we don't have any raw data for this archive, as can happen on
|| strcmp (name, h->root.string) != 0)
{
unsigned int srch;
- boolean found;
+ bfd_boolean found;
/* That was the wrong symbol. Try rehashing. */
- found = false;
+ found = FALSE;
for (srch = (hash + rehash) & (armap_count - 1);
srch != hash;
srch = (srch + rehash) & (armap_count - 1))
if (name[0] == h->root.string[0]
&& strcmp (name, h->root.string) == 0)
{
- found = true;
+ found = TRUE;
break;
}
}
element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset);
if (element == (bfd *) NULL)
- return false;
+ return FALSE;
if (! bfd_check_format (element, bfd_object))
- return false;
+ return FALSE;
/* Unlike the generic linker, we know that this element provides
a definition for an undefined symbol and we know that we want
to include it. We don't need to check anything. */
if (! (*info->callbacks->add_archive_element) (info, element, name))
- return false;
+ return FALSE;
if (! ecoff_link_add_object_symbols (element, info))
- return false;
+ return FALSE;
pundef = &(*pundef)->next;
}
- return true;
+ return TRUE;
}
/* This is called if we used _bfd_generic_link_add_archive_symbols
because we were not dealing with an ECOFF archive. */
-static boolean
+static bfd_boolean
ecoff_link_check_archive_element (abfd, info, pneeded)
bfd *abfd;
struct bfd_link_info *info;
- boolean *pneeded;
+ bfd_boolean *pneeded;
{
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
void (* const swap_ext_in) PARAMS ((bfd *, PTR, EXTR *))
char *ext_ptr;
char *ext_end;
- *pneeded = false;
+ *pneeded = FALSE;
if (! ecoff_slurp_symbolic_header (abfd))
goto error_return;
for (; ext_ptr < ext_end; ext_ptr += external_ext_size)
{
EXTR esym;
- boolean def;
+ bfd_boolean def;
const char *name;
struct bfd_link_hash_entry *h;
case scInit:
case scFini:
case scRConst:
- def = true;
+ def = TRUE;
break;
default:
- def = false;
+ def = FALSE;
break;
}
continue;
name = ssext + esym.asym.iss;
- h = bfd_link_hash_lookup (info->hash, name, false, false, true);
+ h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
/* Unlike the generic linker, we do not pull in elements because
of common symbols. */
if (! ecoff_link_add_externals (abfd, info, external_ext, ssext))
goto error_return;
- *pneeded = true;
+ *pneeded = TRUE;
goto successful_return;
}
free (external_ext);
if (ssext != NULL)
free (ssext);
- return true;
+ return TRUE;
error_return:
if (external_ext != NULL)
free (external_ext);
if (ssext != NULL)
free (ssext);
- return false;
+ return FALSE;
}
/* Add symbols from an ECOFF object file to the global linker hash
table. */
-static boolean
+static bfd_boolean
ecoff_link_add_object_symbols (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
PTR external_ext = NULL;
bfd_size_type esize;
char *ssext = NULL;
- boolean result;
+ bfd_boolean result;
if (! ecoff_slurp_symbolic_header (abfd))
- return false;
+ return FALSE;
/* If there are no symbols, we don't want it. */
if (bfd_get_symcount (abfd) == 0)
- return true;
+ return TRUE;
symhdr = &ecoff_data (abfd)->debug_info.symbolic_header;
free (ssext);
if (external_ext != NULL)
free (external_ext);
- return false;
+ return FALSE;
}
/* Add the external symbols of an object file to the global linker
explicitly save any information we may need later on in the link.
We do not want to read the external symbol information again. */
-static boolean
+static bfd_boolean
ecoff_link_add_externals (abfd, info, external_ext, ssext)
bfd *abfd;
struct bfd_link_info *info;
amt *= sizeof (struct bfd_link_hash_entry *);
sym_hash = (struct bfd_link_hash_entry **) bfd_alloc (abfd, amt);
if (!sym_hash)
- return false;
+ return FALSE;
ecoff_data (abfd)->sym_hashes = (struct ecoff_link_hash_entry **) sym_hash;
ext_ptr = (char *) external_ext;
for (; ext_ptr < ext_end; ext_ptr += external_ext_size, sym_hash++)
{
EXTR esym;
- boolean skip;
+ bfd_boolean skip;
bfd_vma value;
asection *section;
const char *name;
(*swap_ext_in) (abfd, (PTR) ext_ptr, &esym);
/* Skip debugging symbols. */
- skip = false;
+ skip = FALSE;
switch (esym.asym.st)
{
case stGlobal:
case stStaticProc:
break;
default:
- skip = true;
+ skip = TRUE;
break;
}
if (! (_bfd_generic_link_add_one_symbol
(info, abfd, name,
(flagword) (esym.weakext ? BSF_WEAK : BSF_GLOBAL),
- section, value, (const char *) NULL, true, true, sym_hash)))
- return false;
+ section, value, (const char *) NULL, TRUE, TRUE, sym_hash)))
+ return FALSE;
h = (struct ecoff_link_hash_entry *) *sym_hash;
}
}
- return true;
+ return TRUE;
}
\f
/* ECOFF final link routines. */
-static boolean ecoff_final_link_debug_accumulate
+static bfd_boolean ecoff_final_link_debug_accumulate
PARAMS ((bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *,
PTR handle));
-static boolean ecoff_link_write_external
+static bfd_boolean ecoff_link_write_external
PARAMS ((struct ecoff_link_hash_entry *, PTR));
-static boolean ecoff_indirect_link_order
+static bfd_boolean ecoff_indirect_link_order
PARAMS ((bfd *, struct bfd_link_info *, asection *,
struct bfd_link_order *));
-static boolean ecoff_reloc_link_order
+static bfd_boolean ecoff_reloc_link_order
PARAMS ((bfd *, struct bfd_link_info *, asection *,
struct bfd_link_order *));
processes all the link order information. This may cause it to
close and reopen some input BFDs; I'll see how bad this is. */
-boolean
+bfd_boolean
_bfd_ecoff_bfd_final_link (abfd, info)
bfd *abfd;
struct bfd_link_info *info;
handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info);
if (handle == (PTR) NULL)
- return false;
+ return FALSE;
/* Accumulate the debugging symbols from each input BFD. */
for (input_bfd = info->input_bfds;
input_bfd != (bfd *) NULL;
input_bfd = input_bfd->link_next)
{
- boolean ret;
+ bfd_boolean ret;
if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour)
{
debug, &backend->debug_swap,
input_bfd, info);
if (! ret)
- return false;
+ return FALSE;
/* Combine the register masks. */
ecoff_data (abfd)->gprmask |= ecoff_data (input_bfd)->gprmask;
ecoff_link_write_external,
(PTR) &einfo);
- if (info->relocateable)
+ if (info->relocatable)
{
/* We need to make a pass over the link_orders to count up the
number of relocations we will need to output, so that we know
if (! bfd_ecoff_write_accumulated_debug (handle, abfd, debug,
&backend->debug_swap, info,
ecoff_data (abfd)->sym_filepos))
- return false;
+ return FALSE;
bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info);
- if (info->relocateable)
+ if (info->relocatable)
{
/* Now reset the reloc_count field of the sections in the output
BFD to 0, so that we can use them to keep track of how many
{
struct bfd_link_hash_entry *h;
- h = bfd_link_hash_lookup (info->hash, "_gp", false, false, true);
+ h = bfd_link_hash_lookup (info->hash, "_gp", FALSE, FALSE, TRUE);
if (h != (struct bfd_link_hash_entry *) NULL
&& h->type == bfd_link_hash_defined)
ecoff_data (abfd)->gp = (h->u.def.value
+ h->u.def.section->output_section->vma
+ h->u.def.section->output_offset);
- else if (info->relocateable)
+ else if (info->relocatable)
{
bfd_vma lo;
== bfd_target_ecoff_flavour))
{
if (! ecoff_indirect_link_order (abfd, info, o, p))
- return false;
+ return FALSE;
}
else if (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order)
{
if (! ecoff_reloc_link_order (abfd, info, o, p))
- return false;
+ return FALSE;
}
else
{
if (! _bfd_default_link_order (abfd, info, o, p))
- return false;
+ return FALSE;
}
}
}
bfd_get_symcount (abfd) = symhdr->iextMax + symhdr->isymMax;
- ecoff_data (abfd)->linker = true;
+ ecoff_data (abfd)->linker = TRUE;
- return true;
+ return TRUE;
}
/* Accumulate the debugging information for an input BFD into the
output BFD. This must read in the symbolic information of the
input BFD. */
-static boolean
+static bfd_boolean
ecoff_final_link_debug_accumulate (output_bfd, input_bfd, info, handle)
bfd *output_bfd;
bfd *input_bfd;
const struct ecoff_debug_swap * const swap =
&ecoff_backend (input_bfd)->debug_swap;
HDRR *symhdr = &debug->symbolic_header;
- boolean ret;
+ bfd_boolean ret;
#define READ(ptr, offset, count, size, type) \
if (symhdr->count == 0) \
debug->ptr = (type) bfd_malloc (amt); \
if (debug->ptr == NULL) \
{ \
- ret = false; \
+ ret = FALSE; \
goto return_something; \
} \
if (bfd_seek (input_bfd, (file_ptr) symhdr->offset, SEEK_SET) != 0 \
|| bfd_bread (debug->ptr, amt, input_bfd) != amt) \
{ \
- ret = false; \
+ ret = FALSE; \
goto return_something; \
} \
}
/* Put out information for an external symbol. These come only from
the hash table. */
-static boolean
+static bfd_boolean
ecoff_link_write_external (h, data)
struct ecoff_link_hash_entry *h;
PTR data;
{
struct extsym_info *einfo = (struct extsym_info *) data;
bfd *output_bfd = einfo->abfd;
- boolean strip;
+ bfd_boolean strip;
if (h->root.type == bfd_link_hash_warning)
{
h = (struct ecoff_link_hash_entry *) h->root.u.i.link;
if (h->root.type == bfd_link_hash_new)
- return true;
+ return TRUE;
}
/* We need to check if this symbol is being stripped. */
if (h->root.type == bfd_link_hash_undefined
|| h->root.type == bfd_link_hash_undefweak)
- strip = false;
+ strip = FALSE;
else if (einfo->info->strip == strip_all
|| (einfo->info->strip == strip_some
&& bfd_hash_lookup (einfo->info->keep_hash,
h->root.root.string,
- false, false) == NULL))
- strip = true;
+ FALSE, FALSE) == NULL))
+ strip = TRUE;
else
- strip = false;
+ strip = FALSE;
if (strip || h->written)
- return true;
+ return TRUE;
if (h->abfd == (bfd *) NULL)
{
case bfd_link_hash_indirect:
/* We ignore these symbols, since the indirected symbol is
already in the hash table. */
- return true;
+ return TRUE;
}
/* bfd_ecoff_debug_one_external uses iextMax to keep track of the
/* Relocate and write an ECOFF section into an ECOFF output file. */
-static boolean
+static bfd_boolean
ecoff_indirect_link_order (output_bfd, info, output_section, link_order)
bfd *output_bfd;
struct bfd_link_info *info;
BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
if (link_order->size == 0)
- return true;
+ return TRUE;
input_section = link_order->u.indirect.section;
input_bfd = input_section->owner;
cooked_size))
goto error_return;
- /* If we are producing relocateable output, the relocs were
+ /* If we are producing relocatable output, the relocs were
modified, and we write them out now. We use the reloc_count
field of output_section to keep track of the number of relocs we
have output so far. */
- if (info->relocateable)
+ if (info->relocatable)
{
file_ptr pos = (output_section->rel_filepos
+ output_section->reloc_count * external_reloc_size);
free (contents);
if (external_relocs != NULL && section_tdata == NULL)
free (external_relocs);
- return true;
+ return TRUE;
error_return:
if (contents != NULL)
free (contents);
if (external_relocs != NULL && section_tdata == NULL)
free (external_relocs);
- return false;
+ return FALSE;
}
/* Generate a reloc when linking an ECOFF file. This is a reloc
is used to build constructor and destructor tables when linking
with -Ur. */
-static boolean
+static bfd_boolean
ecoff_reloc_link_order (output_bfd, info, output_section, link_order)
bfd *output_bfd;
struct bfd_link_info *info;
struct internal_reloc in;
bfd_size_type external_reloc_size;
bfd_byte *rbuf;
- boolean ok;
+ bfd_boolean ok;
file_ptr pos;
type = link_order->type;
if (rel.howto == 0)
{
bfd_set_error (bfd_error_bad_value);
- return false;
+ return FALSE;
}
if (type == bfd_section_reloc_link_order)
actually against the section. */
h = bfd_wrapped_link_hash_lookup (output_bfd, info,
link_order->u.reloc.p->u.name,
- false, false, false);
+ FALSE, FALSE, FALSE);
if (h != NULL
&& (h->type == bfd_link_hash_defined
|| h->type == bfd_link_hash_defweak))
size = bfd_get_reloc_size (rel.howto);
buf = (bfd_byte *) bfd_zmalloc (size);
if (buf == (bfd_byte *) NULL)
- return false;
+ return FALSE;
rstat = _bfd_relocate_contents (rel.howto, output_bfd,
(bfd_vma) addend, buf);
switch (rstat)
(asection *) NULL, (bfd_vma) 0)))
{
free (buf);
- return false;
+ return FALSE;
}
break;
}
(file_ptr) link_order->offset, size);
free (buf);
if (! ok)
- return false;
+ return FALSE;
}
rel.addend = 0;
h = ((struct ecoff_link_hash_entry *)
bfd_wrapped_link_hash_lookup (output_bfd, info,
link_order->u.reloc.p->u.name,
- false, false, true));
+ FALSE, FALSE, TRUE));
if (h != (struct ecoff_link_hash_entry *) NULL
&& h->indx != -1)
in.r_symndx = h->indx;
if (! ((*info->callbacks->unattached_reloc)
(info, link_order->u.reloc.p->u.name, (bfd *) NULL,
(asection *) NULL, (bfd_vma) 0)))
- return false;
+ return FALSE;
in.r_symndx = 0;
}
in.r_extern = 1;
external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size;
rbuf = (bfd_byte *) bfd_malloc (external_reloc_size);
if (rbuf == (bfd_byte *) NULL)
- return false;
+ return FALSE;
(*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (PTR) rbuf);