X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Fecoff.c;h=7844a50b39d93319c7312dad551b615e45afc88a;hb=75bf2c9cf7dc7dad5e99f337a5d4f677e71dadc9;hp=5c942bd9c92e543b861614a8cc731e0c8d4e8a2b;hpb=695344c018c8e462280c47a644df02ea472b0a4e;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 5c942bd9c9..7844a50b39 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -1,5 +1,5 @@ /* Generic ECOFF (Extended-COFF) routines. - Copyright (C) 1990-2016 Free Software Foundation, Inc. + Copyright (C) 1990-2021 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -24,6 +24,7 @@ #include "bfd.h" #include "bfdlink.h" #include "libbfd.h" +#include "ecoff-bfd.h" #include "aout/ar.h" #include "aout/stab_gnu.h" @@ -45,52 +46,24 @@ #include "libiberty.h" #define streq(a, b) (strcmp ((a), (b)) == 0) -#define strneq(a, b, n) (strncmp ((a), (b), (n)) == 0) /* This stuff is somewhat copied from coffcode.h. */ static asection bfd_debug_section = -{ - /* name, id, index, next, prev, flags, user_set_vma, */ - "*DEBUG*", 0, 0, NULL, NULL, 0, 0, - /* linker_mark, linker_has_input, gc_mark, compress_status, */ - 0, 0, 1, 0, - /* segment_mark, sec_info_type, use_rela_p, */ - 0, 0, 0, - /* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5, */ - 0, 0, 0, 0, 0, 0, - /* vma, lma, size, rawsize, compressed_size, relax, relax_count, */ - 0, 0, 0, 0, 0, 0, 0, - /* output_offset, output_section, alignment_power, */ - 0, NULL, 0, - /* relocation, orelocation, reloc_count, filepos, rel_filepos, */ - NULL, NULL, 0, 0, 0, - /* line_filepos, userdata, contents, lineno, lineno_count, */ - 0, NULL, NULL, NULL, 0, - /* entsize, kept_section, moving_line_filepos, */ - 0, NULL, 0, - /* target_index, used_by_bfd, constructor_chain, owner, */ - 0, NULL, NULL, NULL, - /* symbol, */ - NULL, - /* symbol_ptr_ptr, */ - NULL, - /* map_head, map_tail */ - { NULL }, { NULL } -}; + BFD_FAKE_SECTION (bfd_debug_section, NULL, "*DEBUG*", 0, 0); /* Create an ECOFF object. */ -bfd_boolean +bool _bfd_ecoff_mkobject (bfd *abfd) { - bfd_size_type amt = sizeof (ecoff_data_type); + size_t amt = sizeof (ecoff_data_type); 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 @@ -138,7 +111,7 @@ _bfd_ecoff_mkobject_hook (bfd *abfd, void * filehdr, void * aouthdr) /* Initialize a new section. */ -bfd_boolean +bool _bfd_ecoff_new_section_hook (bfd *abfd, asection *section) { unsigned int i; @@ -153,14 +126,14 @@ _bfd_ecoff_new_section_hook (bfd *abfd, asection *section) { _INIT, SEC_ALLOC | SEC_CODE | SEC_LOAD }, { _FINI, SEC_ALLOC | SEC_CODE | SEC_LOAD }, { _DATA, SEC_ALLOC | SEC_DATA | SEC_LOAD }, - { _SDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD }, + { _SDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_SMALL_DATA }, { _RDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, - { _LIT8, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, - { _LIT4, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, + { _LIT8, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY | SEC_SMALL_DATA}, + { _LIT4, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY | SEC_SMALL_DATA}, { _RCONST, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, { _PDATA, SEC_ALLOC | SEC_DATA | SEC_LOAD | SEC_READONLY}, { _BSS, SEC_ALLOC}, - { _SBSS, SEC_ALLOC}, + { _SBSS, SEC_ALLOC | SEC_SMALL_DATA}, /* An Irix 4 shared libary. */ { _LIB, SEC_COFF_SHARED_LIBRARY} }; @@ -182,12 +155,19 @@ _bfd_ecoff_new_section_hook (bfd *abfd, asection *section) return _bfd_generic_new_section_hook (abfd, section); } +void +_bfd_ecoff_set_alignment_hook (bfd *abfd ATTRIBUTE_UNUSED, + asection *section ATTRIBUTE_UNUSED, + void *scnhdr ATTRIBUTE_UNUSED) +{ +} + /* Determine the machine architecture and type. This is called from the generic COFF routines. It is the inverse of ecoff_get_magic, below. This could be an ECOFF backend routine, with one version for each target, but there aren't all that many ECOFF targets. */ -bfd_boolean +bool _bfd_ecoff_set_arch_mach_hook (bfd *abfd, void * filehdr) { struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; @@ -231,12 +211,12 @@ _bfd_ecoff_set_arch_mach_hook (bfd *abfd, void * filehdr) return bfd_default_set_arch_mach (abfd, arch, mach); } -bfd_boolean +bool _bfd_ecoff_no_long_sections (bfd *abfd, int enable) { (void) abfd; (void) enable; - return FALSE; + return false; } /* Get the magic number to use based on the architecture and machine. @@ -294,29 +274,29 @@ ecoff_sec_to_styp_flags (const char *name, flagword flags) } styp_flags [] = { - { _TEXT, STYP_TEXT }, - { _DATA, STYP_DATA }, - { _SDATA, STYP_SDATA }, - { _RDATA, STYP_RDATA }, - { _LITA, STYP_LITA }, - { _LIT8, STYP_LIT8 }, - { _LIT4, STYP_LIT4 }, - { _BSS, STYP_BSS }, - { _SBSS, STYP_SBSS }, - { _INIT, STYP_ECOFF_INIT }, - { _FINI, STYP_ECOFF_FINI }, - { _PDATA, STYP_PDATA }, - { _XDATA, STYP_XDATA }, - { _LIB, STYP_ECOFF_LIB }, - { _GOT, STYP_GOT }, - { _HASH, STYP_HASH }, - { _DYNAMIC, STYP_DYNAMIC }, - { _LIBLIST, STYP_LIBLIST }, - { _RELDYN, STYP_RELDYN }, - { _CONFLIC, STYP_CONFLIC }, - { _DYNSTR, STYP_DYNSTR }, - { _DYNSYM, STYP_DYNSYM }, - { _RCONST, STYP_RCONST } + { _TEXT, STYP_TEXT }, + { _DATA, STYP_DATA }, + { _SDATA, STYP_SDATA }, + { _RDATA, STYP_RDATA }, + { _LITA, STYP_LITA }, + { _LIT8, STYP_LIT8 }, + { _LIT4, STYP_LIT4 }, + { _BSS, STYP_BSS }, + { _SBSS, STYP_SBSS }, + { _INIT, STYP_ECOFF_INIT }, + { _FINI, STYP_ECOFF_FINI }, + { _PDATA, STYP_PDATA }, + { _XDATA, STYP_XDATA }, + { _LIB, STYP_ECOFF_LIB }, + { _GOT, STYP_GOT }, + { _HASH, STYP_HASH }, + { _DYNAMIC, STYP_DYNAMIC }, + { _LIBLIST, STYP_LIBLIST }, + { _RELDYN, STYP_RELDYN }, + { _CONFLIC, STYP_CONFLIC }, + { _DYNSTR, STYP_DYNSTR }, + { _DYNSYM, STYP_DYNSYM }, + { _RCONST, STYP_RCONST } }; long styp = 0; @@ -354,7 +334,7 @@ ecoff_sec_to_styp_flags (const char *name, flagword flags) /* Get the BFD flags to use for a section. */ -bfd_boolean +bool _bfd_ecoff_styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED, void * hdr, const char *name ATTRIBUTE_UNUSED, @@ -402,28 +382,31 @@ _bfd_ecoff_styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED, || styp_flags == STYP_PDATA || styp_flags == STYP_RCONST) sec_flags |= SEC_READONLY; + if (styp_flags & STYP_SDATA) + sec_flags |= SEC_SMALL_DATA; } - else if ((styp_flags & STYP_BSS) - || (styp_flags & STYP_SBSS)) + else if (styp_flags & STYP_SBSS) + sec_flags |= SEC_ALLOC | SEC_SMALL_DATA; + else if (styp_flags & STYP_BSS) sec_flags |= SEC_ALLOC; else if ((styp_flags & STYP_INFO) || styp_flags == STYP_COMMENT) sec_flags |= SEC_NEVER_LOAD; else if ((styp_flags & STYP_LITA) || (styp_flags & STYP_LIT8) || (styp_flags & STYP_LIT4)) - sec_flags |= SEC_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY; + sec_flags |= SEC_DATA |SEC_SMALL_DATA | SEC_LOAD | SEC_ALLOC | SEC_READONLY; else if (styp_flags & STYP_ECOFF_LIB) sec_flags |= SEC_COFF_SHARED_LIBRARY; else sec_flags |= SEC_ALLOC | SEC_LOAD; * flags_ptr = sec_flags; - return TRUE; + return true; } /* Read in the symbolic header for an ECOFF object file. */ -static bfd_boolean +static bool ecoff_slurp_symbolic_header (bfd *abfd) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); @@ -434,13 +417,13 @@ ecoff_slurp_symbolic_header (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; + abfd->symcount = 0; + return true; } /* At this point bfd_get_symcount (abfd) holds the number of symbols @@ -451,17 +434,16 @@ ecoff_slurp_symbolic_header (bfd *abfd) if (bfd_get_symcount (abfd) != external_hdr_size) { bfd_set_error (bfd_error_bad_value); - return FALSE; + return false; } /* Read the symbolic information header. */ - raw = bfd_malloc (external_hdr_size); + if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) != 0) + goto error_return; + raw = _bfd_malloc_and_read (abfd, external_hdr_size, external_hdr_size); if (raw == NULL) goto error_return; - if (bfd_seek (abfd, ecoff_data (abfd)->sym_filepos, SEEK_SET) != 0 - || bfd_bread (raw, external_hdr_size, abfd) != external_hdr_size) - goto error_return; internal_symhdr = &ecoff_data (abfd)->debug_info.symbolic_header; (*backend->debug_swap.swap_hdr_in) (abfd, raw, internal_symhdr); @@ -472,23 +454,20 @@ ecoff_slurp_symbolic_header (bfd *abfd) } /* Now we can get the correct number of symbols. */ - bfd_get_symcount (abfd) = (internal_symhdr->isymMax - + internal_symhdr->iextMax); + abfd->symcount = internal_symhdr->isymMax + internal_symhdr->iextMax; - if (raw != NULL) - free (raw); - return TRUE; + free (raw); + return true; error_return: - if (raw != NULL) - free (raw); - return FALSE; + free (raw); + 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. */ -bfd_boolean +bool _bfd_ecoff_slurp_symbolic_info (bfd *abfd, asection *ignore ATTRIBUTE_UNUSED, struct ecoff_debug_info *debug) @@ -505,21 +484,22 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, bfd_size_type raw_end; bfd_size_type cb_end; file_ptr pos; + size_t amt; 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 != NULL) - return TRUE; + return true; if (ecoff_data (abfd)->sym_filepos == 0) { - bfd_get_symcount (abfd) = 0; - return TRUE; + abfd->symcount = 0; + return true; } if (! ecoff_slurp_symbolic_header (abfd)) - return FALSE; + return false; internal_symhdr = &debug->symbolic_header; @@ -559,20 +539,15 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, if (raw_size == 0) { ecoff_data (abfd)->sym_filepos = 0; - return TRUE; + return true; } - raw = bfd_alloc (abfd, raw_size); - if (raw == NULL) - return FALSE; - pos = ecoff_data (abfd)->sym_filepos; pos += backend->debug_swap.external_hdr_size; - if (bfd_seek (abfd, pos, SEEK_SET) != 0 - || bfd_bread (raw, raw_size, abfd) != raw_size) - { - bfd_release (abfd, raw); - return FALSE; - } + if (bfd_seek (abfd, pos, SEEK_SET) != 0) + return false; + raw = _bfd_alloc_and_read (abfd, raw_size, raw_size); + if (raw == NULL) + return false; ecoff_data (abfd)->raw_syments = raw; @@ -606,21 +581,26 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, We need to look at the fdr to deal with a lot of information in the symbols, so we swap them here. */ - debug->fdr = (FDR *) bfd_alloc2 (abfd, internal_symhdr->ifdMax, - sizeof (struct fdr)); + if (_bfd_mul_overflow ((unsigned long) internal_symhdr->ifdMax, + sizeof (struct fdr), &amt)) + { + bfd_set_error (bfd_error_file_too_big); + return false; + } + debug->fdr = (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; /* PR 17512: file: 3372-1243-0.004. */ if (fraw_src == NULL && internal_symhdr->ifdMax > 0) - return FALSE; + return false; 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, (void *) fraw_src, fdr_ptr); - return TRUE; + return true; } /* ECOFF symbol table routines. The ECOFF symbol table is described @@ -632,8 +612,11 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, faster assembler code. This is what we use for the small common section. */ static asection ecoff_scom_section; -static asymbol ecoff_scom_symbol; -static asymbol *ecoff_scom_symbol_ptr; +static const asymbol ecoff_scom_symbol = + GLOBAL_SYM_INIT (SCOMMON, &ecoff_scom_section); +static asection ecoff_scom_section = + BFD_FAKE_SECTION (ecoff_scom_section, &ecoff_scom_symbol, + SCOMMON, 0, SEC_IS_COMMON | SEC_SMALL_DATA); /* Create an empty symbol. */ @@ -641,14 +624,14 @@ asymbol * _bfd_ecoff_make_empty_symbol (bfd *abfd) { ecoff_symbol_type *new_symbol; - bfd_size_type amt = sizeof (ecoff_symbol_type); + size_t amt = sizeof (ecoff_symbol_type); new_symbol = (ecoff_symbol_type *) bfd_zalloc (abfd, amt); if (new_symbol == NULL) return NULL; new_symbol->symbol.section = NULL; new_symbol->fdr = NULL; - new_symbol->local = FALSE; + new_symbol->local = false; new_symbol->native = NULL; new_symbol->symbol.the_bfd = abfd; return &new_symbol->symbol; @@ -656,7 +639,7 @@ _bfd_ecoff_make_empty_symbol (bfd *abfd) /* Set the BFD flags and section for an ECOFF symbol. */ -static bfd_boolean +static bool ecoff_set_symbol_info (bfd *abfd, SYMR *ecoff_sym, asymbol *asym, @@ -681,12 +664,12 @@ ecoff_set_symbol_info (bfd *abfd, 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) @@ -697,11 +680,11 @@ ecoff_set_symbol_info (bfd *abfd, { asym->flags = BSF_LOCAL; /* Normally, a local stProc symbol will have a corresponding - external symbol. We mark the local symbol as a debugging - symbol, in order to prevent nm from printing both out. - Similarly, we mark stLabel and stabs symbols as debugging - symbols. In both cases, we do want to set the value - correctly based on the symbol class. */ + external symbol. We mark the local symbol as a debugging + symbol, in order to prevent nm from printing both out. + Similarly, we mark stLabel and stabs symbols as debugging + symbols. In both cases, we do want to set the value + correctly based on the symbol class. */ if (ecoff_sym->st == stProc || ecoff_sym->st == stLabel || ECOFF_IS_STAB (ecoff_sym)) @@ -775,19 +758,6 @@ ecoff_set_symbol_info (bfd *abfd, } /* Fall through. */ case scSCommon: - if (ecoff_scom_section.name == NULL) - { - /* Initialize the small common section. */ - ecoff_scom_section.name = SCOMMON; - ecoff_scom_section.flags = SEC_IS_COMMON; - ecoff_scom_section.output_section = &ecoff_scom_section; - ecoff_scom_section.symbol = &ecoff_scom_symbol; - ecoff_scom_section.symbol_ptr_ptr = &ecoff_scom_symbol_ptr; - ecoff_scom_symbol.name = SCOMMON; - ecoff_scom_symbol.flags = BSF_SECTION_SYM; - ecoff_scom_symbol.section = &ecoff_scom_section; - ecoff_scom_symbol_ptr = &ecoff_scom_symbol; - } asym->section = &ecoff_scom_section; asym->flags = 0; break; @@ -840,12 +810,12 @@ ecoff_set_symbol_info (bfd *abfd, break; } } - return TRUE; + return true; } /* Read an ECOFF symbol table. */ -bfd_boolean +bool _bfd_ecoff_slurp_symbol_table (bfd *abfd) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); @@ -863,22 +833,28 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) char *eraw_end; FDR *fdr_ptr; FDR *fdr_end; + size_t amt; /* 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, NULL, &ecoff_data (abfd)->debug_info)) - return FALSE; + return false; if (bfd_get_symcount (abfd) == 0) - return TRUE; + return true; - internal = (ecoff_symbol_type *) bfd_alloc2 (abfd, bfd_get_symcount (abfd), - sizeof (ecoff_symbol_type)); + if (_bfd_mul_overflow (bfd_get_symcount (abfd), + sizeof (ecoff_symbol_type), &amt)) + { + bfd_set_error (bfd_error_file_too_big); + return false; + } + internal = (ecoff_symbol_type *) bfd_alloc (abfd, amt); if (internal == NULL) - return FALSE; + return false; internal_ptr = internal; eraw_src = (char *) ecoff_data (abfd)->debug_info.external_ext; @@ -894,7 +870,7 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) /* PR 17512: file: 3372-1000-0.004. */ if (internal_esym.asym.iss >= ecoff_data (abfd)->debug_info.symbolic_header.issExtMax || internal_esym.asym.iss < 0) - return FALSE; + return false; internal_ptr->symbol.name = (ecoff_data (abfd)->debug_info.ssext + internal_esym.asym.iss); @@ -902,7 +878,7 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) 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) @@ -916,7 +892,7 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) } else internal_ptr->fdr = NULL; - internal_ptr->local = FALSE; + internal_ptr->local = false; internal_ptr->native = (void *) eraw_src; } @@ -944,9 +920,9 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) + 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 = (void *) lraw_src; } } @@ -958,17 +934,17 @@ _bfd_ecoff_slurp_symbol_table (bfd *abfd) the symbol count and warning the user. */ if (internal_ptr - internal < (ptrdiff_t) bfd_get_symcount (abfd)) { - bfd_get_symcount (abfd) = internal_ptr - internal; + abfd->symcount = internal_ptr - internal; _bfd_error_handler /* xgettext:c-format */ - (_("%B: warning: isymMax (%ld) is greater than ifdMax (%d)\n"), + (_("%pB: warning: isymMax (%ld) is greater than ifdMax (%ld)"), abfd, ecoff_data (abfd)->debug_info.symbolic_header.isymMax, ecoff_data (abfd)->debug_info.symbolic_header.ifdMax); } ecoff_data (abfd)->canonical_symbols = internal; - return TRUE; + return true; } /* Return the amount of space needed for the canonical symbols. */ @@ -1079,7 +1055,7 @@ ecoff_emit_aggregate (bfd *abfd, /* Convert the type information to string format. */ static char * -ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx) +ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx, char *buff) { union aux_ext *aux_ptr; int bigendian; @@ -1094,9 +1070,8 @@ ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx) unsigned int basic_type; int i; char buffer1[1024]; - static char buffer2[1024]; char *p1 = buffer1; - char *p2 = buffer2; + char *p2 = buff; RNDXR rndx; aux_ptr = ecoff_data (abfd)->debug_info.external_aux + fdr->iauxBase; @@ -1258,11 +1233,11 @@ ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx) break; default: - sprintf (p1, _("Unknown basic type %d"), (int) basic_type); + sprintf (p1, _("unknown basic type %d"), (int) basic_type); break; } - p1 += strlen (buffer1); + p1 += strlen (p1); /* If this is a bitfield, get the bitsize. */ if (u.ti.fBitfield) @@ -1271,19 +1246,18 @@ ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx) bitsize = AUX_GET_WIDTH (bigendian, &aux_ptr[indx++]); sprintf (p1, " : %d", bitsize); - p1 += strlen (buffer1); } /* Deal with any qualifiers. */ if (qualifiers[0].type != tqNil) { /* Snarf up any array bounds in the correct order. Arrays - store 5 successive words in the aux. table: - word 0 RNDXR to type of the bounds (ie, int) - word 1 Current file descriptor index - word 2 low bound - word 3 high bound (or -1 if []) - word 4 stride size in bits. */ + store 5 successive words in the aux. table: + word 0 RNDXR to type of the bounds (ie, int) + word 1 Current file descriptor index + word 2 low bound + word 3 high bound (or -1 if []) + word 4 stride size in bits. */ for (i = 0; i < 7; i++) { if (qualifiers[i].type == tqArray) @@ -1355,7 +1329,7 @@ ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx) (long) (qualifiers[j].stride)); else - sprintf (p2, " {%ld bits}", (long) (qualifiers[j].stride)); + sprintf (p2, " {%ld bits}", (long) qualifiers[j].stride); p2 += strlen (p2); strcpy (p2, "] of "); @@ -1368,7 +1342,7 @@ ecoff_type_to_string (bfd *abfd, FDR *fdr, unsigned int indx) } strcpy (p2, buffer1); - return buffer2; + return buff; } /* Return information about ECOFF symbol SYMBOL in RET. */ @@ -1383,7 +1357,7 @@ _bfd_ecoff_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, /* Return whether this is a local label. */ -bfd_boolean +bool _bfd_ecoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) { @@ -1537,13 +1511,16 @@ _bfd_ecoff_print_symbol (bfd *abfd, if (ECOFF_IS_STAB (&ecoff_ext.asym)) ; else if (ecoffsymbol (symbol)->local) - /* xgettext:c-format */ - fprintf (file, _("\n End+1 symbol: %-7ld Type: %s"), - ((long) - (AUX_GET_ISYM (bigendian, - &aux_base[ecoff_ext.asym.index]) - + sym_base)), - ecoff_type_to_string (abfd, fdr, indx + 1)); + { + char buff[1024]; + /* xgettext:c-format */ + fprintf (file, _("\n End+1 symbol: %-7ld Type: %s"), + ((long) + (AUX_GET_ISYM (bigendian, + &aux_base[ecoff_ext.asym.index]) + + sym_base)), + ecoff_type_to_string (abfd, fdr, indx + 1, buff)); + } else fprintf (file, _("\n Local symbol: %ld"), ((long) indx @@ -1569,8 +1546,11 @@ _bfd_ecoff_print_symbol (bfd *abfd, default: if (! ECOFF_IS_STAB (&ecoff_ext.asym)) - fprintf (file, _("\n Type: %s"), - ecoff_type_to_string (abfd, fdr, indx)); + { + char buff[1024]; + fprintf (file, _("\n Type: %s"), + ecoff_type_to_string (abfd, fdr, indx, buff)); + } break; } } @@ -1581,7 +1561,7 @@ _bfd_ecoff_print_symbol (bfd *abfd, /* Read in the relocs for a section. */ -static bfd_boolean +static bool ecoff_slurp_reloc_table (bfd *abfd, asection *section, asymbol **symbols) @@ -1590,31 +1570,34 @@ ecoff_slurp_reloc_table (bfd *abfd, arelent *internal_relocs; bfd_size_type external_reloc_size; bfd_size_type amt; - char *external_relocs; + bfd_byte *external_relocs; arelent *rptr; unsigned int i; if (section->relocation != NULL || section->reloc_count == 0 || (section->flags & SEC_CONSTRUCTOR) != 0) - return TRUE; + return true; if (! _bfd_ecoff_slurp_symbol_table (abfd)) - return FALSE; - - amt = section->reloc_count; - amt *= sizeof (arelent); - internal_relocs = (arelent *) bfd_alloc (abfd, amt); + return false; external_reloc_size = backend->external_reloc_size; amt = external_reloc_size * section->reloc_count; - external_relocs = (char *) bfd_alloc (abfd, amt); - if (internal_relocs == NULL || external_relocs == NULL) - return FALSE; if (bfd_seek (abfd, section->rel_filepos, SEEK_SET) != 0) - return FALSE; - if (bfd_bread (external_relocs, amt, abfd) != amt) - return FALSE; + return false; + external_relocs = _bfd_malloc_and_read (abfd, amt, amt); + if (external_relocs == NULL) + return false; + + amt = section->reloc_count; + amt *= sizeof (arelent); + internal_relocs = (arelent *) bfd_alloc (abfd, amt); + if (internal_relocs == NULL) + { + free (external_relocs); + return false; + } for (i = 0, rptr = internal_relocs; i < section->reloc_count; i++, rptr++) { @@ -1670,21 +1653,21 @@ ecoff_slurp_reloc_table (bfd *abfd, abort (); rptr->sym_ptr_ptr = sec->symbol_ptr_ptr; - rptr->addend = - bfd_get_section_vma (abfd, sec); + rptr->addend = - bfd_section_vma (sec); } - rptr->address = intern.r_vaddr - bfd_get_section_vma (abfd, section); + rptr->address = intern.r_vaddr - bfd_section_vma (section); /* Let the backend select the howto field and do any other required processing. */ (*backend->adjust_reloc_in) (abfd, &intern, rptr); } - bfd_release (abfd, external_relocs); + free (external_relocs); section->relocation = internal_relocs; - return TRUE; + return true; } /* Get a canonical list of relocs. */ @@ -1731,7 +1714,7 @@ _bfd_ecoff_canonicalize_reloc (bfd *abfd, and return the name of the source file and the line nearest to the wanted location. */ -bfd_boolean +bool _bfd_ecoff_find_nearest_line (bfd *abfd, asymbol **symbols ATTRIBUTE_UNUSED, asection *section, @@ -1749,16 +1732,16 @@ _bfd_ecoff_find_nearest_line (bfd *abfd, /* Make sure we have the FDR's. */ if (! _bfd_ecoff_slurp_symbolic_info (abfd, NULL, debug_info) || bfd_get_symcount (abfd) == 0) - return FALSE; + return false; if (ecoff_data (abfd)->find_line_info == NULL) { - bfd_size_type amt = sizeof (struct ecoff_find_line); + size_t amt = sizeof (struct ecoff_find_line); ecoff_data (abfd)->find_line_info = - (struct ecoff_find_line *) bfd_zalloc (abfd, amt); + (struct ecoff_find_line *) bfd_zalloc (abfd, amt); if (ecoff_data (abfd)->find_line_info == NULL) - return FALSE; + return false; } if (discriminator_ptr) @@ -1782,7 +1765,7 @@ _bfd_ecoff_find_nearest_line (bfd *abfd, the symbol table, so this function only handles the other debugging information. */ -bfd_boolean +bool _bfd_ecoff_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd) { struct ecoff_debug_info *iinfo = &ecoff_data (ibfd)->debug_info; @@ -1790,13 +1773,13 @@ _bfd_ecoff_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd) int i; asymbol **sym_ptr_ptr; size_t c; - bfd_boolean local; + bool 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; @@ -1812,15 +1795,15 @@ _bfd_ecoff_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd) c = bfd_get_symcount (obfd); sym_ptr_ptr = bfd_get_outsymbols (obfd); if (c == 0 || sym_ptr_ptr == 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; } } @@ -1883,14 +1866,14 @@ _bfd_ecoff_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd) } } - return TRUE; + return true; } /* 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. */ -bfd_boolean +bool _bfd_ecoff_set_arch_mach (bfd *abfd, enum bfd_architecture arch, unsigned long machine) @@ -1923,7 +1906,7 @@ _bfd_ecoff_sizeof_headers (bfd *abfd, /* Get the contents of a section. */ -bfd_boolean +bool _bfd_ecoff_get_section_contents (bfd *abfd, asection *section, void * location, @@ -1964,7 +1947,7 @@ ecoff_sort_hdrs (const void * arg1, const void * arg2) /* Calculate the file position for each section, and set reloc_filepos. */ -static bfd_boolean +static bool ecoff_compute_section_file_positions (bfd *abfd) { file_ptr sofar, file_sofar; @@ -1972,8 +1955,8 @@ ecoff_compute_section_file_positions (bfd *abfd) asection *current; unsigned int i; file_ptr old_sofar; - bfd_boolean rdata_in_text; - bfd_boolean first_data, first_nonalloc; + bool rdata_in_text; + bool first_data, first_nonalloc; const bfd_vma round = ecoff_backend (abfd)->round; bfd_size_type amt; @@ -1985,7 +1968,7 @@ ecoff_compute_section_file_positions (bfd *abfd) 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++) @@ -2009,15 +1992,15 @@ ecoff_compute_section_file_positions (bfd *abfd) && ! streq (current->name, _PDATA) && ! streq (current->name, _RCONST)) { - 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; @@ -2050,7 +2033,7 @@ ecoff_compute_section_file_positions (bfd *abfd) { sofar = (sofar + round - 1) &~ (round - 1); file_sofar = (file_sofar + round - 1) &~ (round - 1); - first_data = FALSE; + first_data = false; } else if (streq (current->name, _LIB)) { @@ -2066,9 +2049,9 @@ ecoff_compute_section_file_positions (bfd *abfd) && (abfd->flags & D_PAGED) != 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; + as the .comment section on the Alpha. This leaves room + for the .bss section. */ + first_nonalloc = false; sofar = (sofar + round - 1) &~ (round - 1); file_sofar = (file_sofar + round - 1) &~ (round - 1); } @@ -2107,7 +2090,7 @@ ecoff_compute_section_file_positions (bfd *abfd) ecoff_data (abfd)->reloc_filepos = file_sofar; - return TRUE; + return true; } /* Determine the location of the relocs for all the sections in the @@ -2128,7 +2111,7 @@ ecoff_compute_reloc_file_positions (bfd *abfd) { 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; @@ -2168,7 +2151,7 @@ ecoff_compute_reloc_file_positions (bfd *abfd) /* Set the contents of a section. */ -bfd_boolean +bool _bfd_ecoff_set_section_contents (bfd *abfd, asection *section, const void * location, @@ -2181,7 +2164,7 @@ _bfd_ecoff_set_section_contents (bfd *abfd, going to set output_has_begun to TRUE. */ if (! abfd->output_has_begun && ! ecoff_compute_section_file_positions (abfd)) - return FALSE; + return false; /* Handle the .lib section specially so that Irix 4 shared libraries work out. See coff_set_section_contents in coffcode.h. */ @@ -2201,54 +2184,38 @@ _bfd_ecoff_set_section_contents (bfd *abfd, } 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 TRUE; -} - -/* Get the GP value for an ECOFF file. This is a hook used by - nlmconv. */ - -bfd_vma -bfd_ecoff_get_gp_value (bfd *abfd) -{ - if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour - || bfd_get_format (abfd) != bfd_object) - { - bfd_set_error (bfd_error_invalid_operation); - return 0; - } + return false; - return ecoff_data (abfd)->gp; + return true; } /* Set the GP value for an ECOFF file. This is a hook used by the assembler. */ -bfd_boolean +bool bfd_ecoff_set_gp_value (bfd *abfd, bfd_vma gp_value) { if (bfd_get_flavour (abfd) != bfd_target_ecoff_flavour || 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. */ -bfd_boolean +bool bfd_ecoff_set_regmasks (bfd *abfd, unsigned long gprmask, unsigned long fprmask, @@ -2260,7 +2227,7 @@ bfd_ecoff_set_regmasks (bfd *abfd, || bfd_get_format (abfd) != bfd_object) { bfd_set_error (bfd_error_invalid_operation); - return FALSE; + return false; } tdata = ecoff_data (abfd); @@ -2274,13 +2241,13 @@ bfd_ecoff_set_regmasks (bfd *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 bfd_boolean +static bool ecoff_get_extr (asymbol *sym, EXTR *esym) { ecoff_symbol_type *ecoff_sym_ptr; @@ -2293,7 +2260,7 @@ ecoff_get_extr (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; @@ -2305,13 +2272,13 @@ ecoff_get_extr (asymbol *sym, EXTR *esym) 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)) @@ -2322,7 +2289,7 @@ ecoff_get_extr (asymbol *sym, EXTR *esym) symbol. */ if ((esym->asym.sc == scUndefined || esym->asym.sc == scSUndefined) - && ! bfd_is_und_section (bfd_get_section (sym))) + && ! bfd_is_und_section (bfd_asymbol_section (sym))) esym->asym.sc = scAbs; /* Adjust the FDR index for the symbol by that used for the input @@ -2337,7 +2304,7 @@ ecoff_get_extr (asymbol *sym, EXTR *esym) esym->ifd = input_debug->ifdmap[esym->ifd]; } - return TRUE; + return true; } /* Set the external symbol index. This routine is passed to @@ -2351,7 +2318,7 @@ ecoff_set_index (asymbol *sym, bfd_size_type indx) /* Write out an ECOFF file. */ -bfd_boolean +bool _bfd_ecoff_write_object_contents (bfd *abfd) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); @@ -2373,10 +2340,10 @@ _bfd_ecoff_write_object_contents (bfd *abfd) bfd_size_type reloc_size; bfd_size_type text_size; bfd_vma text_start; - bfd_boolean set_text_start; + bool set_text_start; bfd_size_type data_size; bfd_vma data_start; - bfd_boolean set_data_start; + bool set_data_start; bfd_size_type bss_size; void * buff = NULL; void * reloc_buff = NULL; @@ -2402,10 +2369,10 @@ _bfd_ecoff_write_object_contents (bfd *abfd) 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. */ @@ -2441,7 +2408,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) strncpy (section.s_name, current->name, sizeof section.s_name); /* This seems to be correct for Irix 4 shared libraries. */ - vma = bfd_get_section_vma (abfd, current); + vma = bfd_section_vma (current); if (streq (current->name, _LIB)) section.s_vaddr = 0; else @@ -2503,7 +2470,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) 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 @@ -2519,7 +2486,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) 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 @@ -2692,8 +2659,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) if (reloc->howto == NULL) continue; - in.r_vaddr = (reloc->address - + bfd_get_section_vma (abfd, current)); + in.r_vaddr = reloc->address + bfd_section_vma (current); in.r_type = reloc->howto->type; if ((sym->flags & BSF_SECTION_SYM) == 0) @@ -2729,7 +2695,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) { _RCONST, RELOC_SECTION_RCONST } }; - name = bfd_get_section_name (abfd, bfd_get_section (sym)); + name = bfd_section_name (bfd_asymbol_section (sym)); for (j = 0; j < ARRAY_SIZE (section_symndx); j++) if (streq (name, section_symndx[j].name)) @@ -2791,15 +2757,13 @@ _bfd_ecoff_write_object_contents (bfd *abfd) if (reloc_buff != NULL) bfd_release (abfd, reloc_buff); - if (buff != NULL) - free (buff); - return TRUE; + free (buff); + return true; error_return: if (reloc_buff != NULL) bfd_release (abfd, reloc_buff); - if (buff != NULL) - free (buff); - return FALSE; + free (buff); + return false; } /* Archive handling. ECOFF uses what appears to be a unique type of @@ -2832,19 +2796,19 @@ _bfd_ecoff_write_object_contents (bfd *abfd) The Alpha seems to use ________64E[BL]E[BL]_. */ -#define ARMAP_BIG_ENDIAN 'B' -#define ARMAP_LITTLE_ENDIAN 'L' -#define ARMAP_MARKER 'E' -#define ARMAP_START_LENGTH 10 +#define ARMAP_BIG_ENDIAN 'B' +#define ARMAP_LITTLE_ENDIAN 'L' +#define ARMAP_MARKER 'E' +#define ARMAP_START_LENGTH 10 #define ARMAP_HEADER_MARKER_INDEX 10 -#define ARMAP_HEADER_ENDIAN_INDEX 11 -#define ARMAP_OBJECT_MARKER_INDEX 12 -#define ARMAP_OBJECT_ENDIAN_INDEX 13 -#define ARMAP_END_INDEX 14 -#define ARMAP_END "_ " +#define ARMAP_HEADER_ENDIAN_INDEX 11 +#define ARMAP_OBJECT_MARKER_INDEX 12 +#define ARMAP_OBJECT_ENDIAN_INDEX 13 +#define ARMAP_END_INDEX 14 +#define ARMAP_END "_ " /* This is a magic number used in the hashing algorithm. */ -#define ARMAP_HASH_MAGIC 0x9dd68ab5 +#define ARMAP_HASH_MAGIC 0x9dd68ab5 /* This returns the hash value to use for a string. It also sets *REHASH to the rehash adjustment if the first slot is taken. SIZE @@ -2871,13 +2835,13 @@ ecoff_armap_hash (const char *s, /* Read in the armap. */ -bfd_boolean +bool _bfd_ecoff_slurp_armap (bfd *abfd) { char nextname[17]; unsigned int i; struct areltdata *mapdata; - bfd_size_type parsed_size; + bfd_size_type parsed_size, stringsize; char *raw_armap; struct artdata *ardata; unsigned int count; @@ -2889,33 +2853,33 @@ _bfd_ecoff_slurp_armap (bfd *abfd) /* Get the name of the first element. */ i = bfd_bread ((void *) 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 bfd_slurp_armap, but that seems inappropriate since no other target uses this format. Instead, we check directly for a COFF armap. */ - if (CONST_STRNEQ (nextname, "/ ")) + if (startswith (nextname, "/ ")) return bfd_slurp_armap (abfd); /* See if the first element is an armap. */ - if (! strneq (nextname, ecoff_backend (abfd)->armap_start, ARMAP_START_LENGTH) + if (strncmp (nextname, ecoff_backend (abfd)->armap_start, ARMAP_START_LENGTH) != 0 || nextname[ARMAP_HEADER_MARKER_INDEX] != ARMAP_MARKER || (nextname[ARMAP_HEADER_ENDIAN_INDEX] != ARMAP_BIG_ENDIAN && nextname[ARMAP_HEADER_ENDIAN_INDEX] != ARMAP_LITTLE_ENDIAN) || nextname[ARMAP_OBJECT_MARKER_INDEX] != ARMAP_MARKER || (nextname[ARMAP_OBJECT_ENDIAN_INDEX] != ARMAP_BIG_ENDIAN && nextname[ARMAP_OBJECT_ENDIAN_INDEX] != ARMAP_LITTLE_ENDIAN) - || ! strneq (nextname + ARMAP_END_INDEX, ARMAP_END, sizeof ARMAP_END - 1)) + || strncmp (nextname + ARMAP_END_INDEX, ARMAP_END, sizeof ARMAP_END - 1) != 0) { - bfd_has_map (abfd) = FALSE; - return TRUE; + abfd->has_armap = false; + return true; } /* Make sure we have the right byte ordering. */ @@ -2925,32 +2889,33 @@ _bfd_ecoff_slurp_armap (bfd *abfd) ^ (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 == NULL) - return FALSE; + return false; parsed_size = mapdata->parsed_size; free (mapdata); - raw_armap = (char *) bfd_alloc (abfd, parsed_size); - if (raw_armap == NULL) - return FALSE; - - if (bfd_bread ((void *) raw_armap, parsed_size, abfd) != parsed_size) + if (parsed_size + 1 < 9) { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_malformed_archive); - bfd_release (abfd, (void *) raw_armap); - return FALSE; + bfd_set_error (bfd_error_malformed_archive); + return false; } + raw_armap = (char *) _bfd_alloc_and_read (abfd, parsed_size + 1, parsed_size); + if (raw_armap == NULL) + return false; + raw_armap[parsed_size] = 0; + ardata->tdata = (void *) raw_armap; count = H_GET_32 (abfd, raw_armap); + if ((parsed_size - 8) / 8 < count) + goto error_malformed; ardata->symdef_count = 0; ardata->cache = NULL; @@ -2958,6 +2923,7 @@ _bfd_ecoff_slurp_armap (bfd *abfd) /* This code used to overlay the symdefs over the raw archive data, but that doesn't work on a 64 bit host. */ stringbase = raw_armap + count * 8 + 8; + stringsize = parsed_size - (count * 8 + 8); #ifdef CHECK_ARMAP_HASH { @@ -3005,7 +2971,7 @@ _bfd_ecoff_slurp_armap (bfd *abfd) amt *= sizeof (carsym); symdef_ptr = (carsym *) bfd_alloc (abfd, amt); if (!symdef_ptr) - return FALSE; + goto error_exit; ardata->symdefs = symdef_ptr; @@ -3018,6 +2984,8 @@ _bfd_ecoff_slurp_armap (bfd *abfd) if (file_offset == 0) continue; name_offset = H_GET_32 (abfd, raw_ptr); + if (name_offset > stringsize) + goto error_malformed; symdef_ptr->name = stringbase + name_offset; symdef_ptr->file_offset = file_offset; ++symdef_ptr; @@ -3026,15 +2994,22 @@ _bfd_ecoff_slurp_armap (bfd *abfd) ardata->first_file_filepos = bfd_tell (abfd); /* Pad to an even boundary. */ ardata->first_file_filepos += ardata->first_file_filepos % 2; + abfd->has_armap = true; + return true; - bfd_has_map (abfd) = TRUE; - - return TRUE; + error_malformed: + bfd_set_error (bfd_error_malformed_archive); + error_exit: + ardata->symdef_count = 0; + ardata->symdefs = NULL; + ardata->tdata = NULL; + bfd_release (abfd, raw_armap); + return false; } /* Write out an armap. */ -bfd_boolean +bool _bfd_ecoff_write_armap (bfd *abfd, unsigned int elength, struct orl *map, @@ -3089,7 +3064,7 @@ _bfd_ecoff_write_armap (bfd *abfd, complain that the index is out of date. Actually, the Ultrix linker just checks the archive name; the GNU linker may check the date. */ - stat (abfd->filename, &statbuf); + stat (bfd_get_filename (abfd), &statbuf); _bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld", (long) (statbuf.st_mtime + 60)); @@ -3114,15 +3089,15 @@ _bfd_ecoff_write_armap (bfd *abfd, if (bfd_bwrite ((void *) &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 ((void *) 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; @@ -3167,21 +3142,21 @@ _bfd_ecoff_write_armap (bfd *abfd, } if (bfd_bwrite ((void *) 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 ((void *) 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 ((void *) (*map[i].name), len, abfd) != len) - return FALSE; + return false; } /* The spec sez this should be a newline. But in order to be @@ -3189,10 +3164,10 @@ _bfd_ecoff_write_armap (bfd *abfd, if (padit) { if (bfd_bwrite ("", (bfd_size_type) 1, abfd) != 1) - return FALSE; + return false; } - return TRUE; + return true; } /* ECOFF linker code. */ @@ -3238,7 +3213,7 @@ struct bfd_link_hash_table * _bfd_ecoff_bfd_link_hash_table_create (bfd *abfd) { struct ecoff_link_hash_table *ret; - bfd_size_type amt = sizeof (struct ecoff_link_hash_table); + size_t amt = sizeof (struct ecoff_link_hash_table); ret = (struct ecoff_link_hash_table *) bfd_malloc (amt); if (ret == NULL) @@ -3270,7 +3245,7 @@ _bfd_ecoff_bfd_link_hash_table_create (bfd *abfd) explicitly save any information we may need later on in the link. We do not want to read the external symbol information again. */ -static bfd_boolean +static bool ecoff_link_add_externals (bfd *abfd, struct bfd_link_info *info, void * external_ext, @@ -3292,7 +3267,7 @@ ecoff_link_add_externals (bfd *abfd, 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; @@ -3300,7 +3275,7 @@ ecoff_link_add_externals (bfd *abfd, for (; ext_ptr < ext_end; ext_ptr += external_ext_size, sym_hash++) { EXTR esym; - bfd_boolean skip; + bool skip; bfd_vma value; asection *section; const char *name; @@ -3311,7 +3286,7 @@ ecoff_link_add_externals (bfd *abfd, (*swap_ext_in) (abfd, (void *) ext_ptr, &esym); /* Skip debugging symbols. */ - skip = FALSE; + skip = false; switch (esym.asym.st) { case stGlobal: @@ -3321,7 +3296,7 @@ ecoff_link_add_externals (bfd *abfd, case stStaticProc: break; default: - skip = TRUE; + skip = true; break; } @@ -3387,19 +3362,6 @@ ecoff_link_add_externals (bfd *abfd, } /* Fall through. */ case scSCommon: - if (ecoff_scom_section.name == NULL) - { - /* Initialize the small common section. */ - ecoff_scom_section.name = SCOMMON; - ecoff_scom_section.flags = SEC_IS_COMMON; - ecoff_scom_section.output_section = &ecoff_scom_section; - ecoff_scom_section.symbol = &ecoff_scom_symbol; - ecoff_scom_section.symbol_ptr_ptr = &ecoff_scom_symbol_ptr; - ecoff_scom_symbol.name = SCOMMON; - ecoff_scom_symbol.flags = BSF_SECTION_SYM; - ecoff_scom_symbol.section = &ecoff_scom_section; - ecoff_scom_symbol_ptr = &ecoff_scom_symbol; - } section = &ecoff_scom_section; break; case scSUndefined: @@ -3427,8 +3389,8 @@ ecoff_link_add_externals (bfd *abfd, if (! (_bfd_generic_link_add_one_symbol (info, abfd, name, (flagword) (esym.weakext ? BSF_WEAK : BSF_GLOBAL), - section, value, NULL, TRUE, TRUE, sym_hash))) - return FALSE; + section, value, NULL, true, true, sym_hash))) + return false; h = (struct ecoff_link_hash_entry *) *sym_hash; @@ -3468,13 +3430,13 @@ ecoff_link_add_externals (bfd *abfd, } } - return TRUE; + return true; } /* Add symbols from an ECOFF object file to the global linker hash table. */ -static bfd_boolean +static bool ecoff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { HDRR *symhdr; @@ -3482,74 +3444,66 @@ ecoff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) void * external_ext = NULL; bfd_size_type esize; char *ssext = NULL; - bfd_boolean result; + bool 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; /* Read in the external symbols and external strings. */ + if (bfd_seek (abfd, symhdr->cbExtOffset, SEEK_SET) != 0) + return false; external_ext_size = ecoff_backend (abfd)->debug_swap.external_ext_size; esize = symhdr->iextMax * external_ext_size; - external_ext = bfd_malloc (esize); + external_ext = _bfd_malloc_and_read (abfd, esize, esize); if (external_ext == NULL && esize != 0) goto error_return; - if (bfd_seek (abfd, (file_ptr) symhdr->cbExtOffset, SEEK_SET) != 0 - || bfd_bread (external_ext, esize, abfd) != esize) + if (bfd_seek (abfd, symhdr->cbSsExtOffset, SEEK_SET) != 0) goto error_return; - - ssext = (char *) bfd_malloc ((bfd_size_type) symhdr->issExtMax); + ssext = (char *) _bfd_malloc_and_read (abfd, symhdr->issExtMax, + symhdr->issExtMax); if (ssext == NULL && symhdr->issExtMax != 0) goto error_return; - if (bfd_seek (abfd, (file_ptr) symhdr->cbSsExtOffset, SEEK_SET) != 0 - || (bfd_bread (ssext, (bfd_size_type) symhdr->issExtMax, abfd) - != (bfd_size_type) symhdr->issExtMax)) - goto error_return; - result = ecoff_link_add_externals (abfd, info, external_ext, ssext); - if (ssext != NULL) - free (ssext); - if (external_ext != NULL) - free (external_ext); + free (ssext); + free (external_ext); return result; error_return: - if (ssext != NULL) - free (ssext); - if (external_ext != NULL) - free (external_ext); - return FALSE; + free (ssext); + free (external_ext); + return false; } /* This is called if we used _bfd_generic_link_add_archive_symbols because we were not dealing with an ECOFF archive. */ -static bfd_boolean +static bool ecoff_link_check_archive_element (bfd *abfd, struct bfd_link_info *info, struct bfd_link_hash_entry *h, const char *name, - bfd_boolean *pneeded) + bool *pneeded) { - *pneeded = FALSE; + *pneeded = false; /* Unlike the generic linker, we do not pull in elements because of common symbols. */ if (h->type != bfd_link_hash_undefined) - return TRUE; + return true; /* Include this element? */ if (!(*info->callbacks->add_archive_element) (info, abfd, name, &abfd)) - return TRUE; - *pneeded = TRUE; + return true; + *pneeded = true; return ecoff_link_add_object_symbols (abfd, info); } @@ -3561,7 +3515,7 @@ ecoff_link_check_archive_element (bfd *abfd, already have a hash table, so there is no reason to construct another one. */ -static bfd_boolean +static bool ecoff_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); @@ -3577,9 +3531,9 @@ ecoff_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) { /* An empty archive is a special case. */ if (bfd_openr_next_archived_file (abfd, 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 @@ -3657,10 +3611,10 @@ ecoff_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) || ! streq (name, h->root.string)) { unsigned int srch; - bfd_boolean found; + bool 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)) @@ -3672,7 +3626,7 @@ ecoff_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) if (name[0] == h->root.string[0] && streq (name, h->root.string)) { - found = TRUE; + found = true; break; } } @@ -3688,30 +3642,30 @@ ecoff_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) element = (*backend->get_elt_at_filepos) (abfd, (file_ptr) file_offset); if (element == 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, &element)) - return FALSE; + return false; if (! ecoff_link_add_object_symbols (element, info)) - return FALSE; + return false; pundef = &(*pundef)->u.undef.next; } - return TRUE; + return true; } /* Given an ECOFF BFD, add symbols to the global hash table as appropriate. */ -bfd_boolean +bool _bfd_ecoff_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) { switch (bfd_get_format (abfd)) @@ -3722,7 +3676,7 @@ _bfd_ecoff_bfd_link_add_symbols (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; } } @@ -3741,7 +3695,7 @@ struct extsym_info output BFD. This must read in the symbolic information of the input BFD. */ -static bfd_boolean +static bool ecoff_final_link_debug_accumulate (bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info, @@ -3751,27 +3705,33 @@ ecoff_final_link_debug_accumulate (bfd *output_bfd, const struct ecoff_debug_swap * const swap = &ecoff_backend (input_bfd)->debug_swap; HDRR *symhdr = &debug->symbolic_header; - bfd_boolean ret; - -#define READ(ptr, offset, count, size, type) \ - if (symhdr->count == 0) \ - debug->ptr = NULL; \ - else \ - { \ - bfd_size_type amt = (bfd_size_type) size * symhdr->count; \ - debug->ptr = (type) bfd_malloc (amt); \ - if (debug->ptr == NULL) \ - { \ - 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; \ - goto return_something; \ - } \ - } + bool ret; + +#define READ(ptr, offset, count, size, type) \ + do \ + { \ + size_t amt; \ + debug->ptr = NULL; \ + if (symhdr->count == 0) \ + break; \ + if (_bfd_mul_overflow (size, symhdr->count, &amt)) \ + { \ + bfd_set_error (bfd_error_file_too_big); \ + ret = false; \ + goto return_something; \ + } \ + if (bfd_seek (input_bfd, symhdr->offset, SEEK_SET) != 0) \ + { \ + ret = false; \ + goto return_something; \ + } \ + debug->ptr = (type) _bfd_malloc_and_read (input_bfd, amt, amt); \ + if (debug->ptr == NULL) \ + { \ + ret = false; \ + goto return_something; \ + } \ + } while (0) /* If raw_syments is not NULL, then the data was already by read by _bfd_ecoff_slurp_symbolic_info. */ @@ -3801,24 +3761,15 @@ ecoff_final_link_debug_accumulate (bfd *output_bfd, return_something: if (ecoff_data (input_bfd)->raw_syments == NULL) { - if (debug->line != NULL) - free (debug->line); - if (debug->external_dnr != NULL) - free (debug->external_dnr); - if (debug->external_pdr != NULL) - free (debug->external_pdr); - if (debug->external_sym != NULL) - free (debug->external_sym); - if (debug->external_opt != NULL) - free (debug->external_opt); - if (debug->external_aux != NULL) - free (debug->external_aux); - if (debug->ss != NULL) - free (debug->ss); - if (debug->external_fdr != NULL) - free (debug->external_fdr); - if (debug->external_rfd != NULL) - free (debug->external_rfd); + free (debug->line); + free (debug->external_dnr); + free (debug->external_pdr); + free (debug->external_sym); + free (debug->external_opt); + free (debug->external_aux); + free (debug->ss); + free (debug->external_fdr); + free (debug->external_rfd); /* Make sure we don't accidentally follow one of these pointers into freed memory. */ @@ -3838,7 +3789,7 @@ ecoff_final_link_debug_accumulate (bfd *output_bfd, /* Relocate and write an ECOFF section into an ECOFF output file. */ -static bfd_boolean +static bool ecoff_indirect_link_order (bfd *output_bfd, struct bfd_link_info *info, asection *output_section, @@ -3856,7 +3807,7 @@ ecoff_indirect_link_order (bfd *output_bfd, input_section = link_order->u.indirect.section; input_bfd = input_section->owner; if (input_section->size == 0) - return TRUE; + return true; BFD_ASSERT (input_section->output_section == output_section); BFD_ASSERT (input_section->output_offset == link_order->offset); @@ -3871,13 +3822,11 @@ ecoff_indirect_link_order (bfd *output_bfd, external_reloc_size = ecoff_backend (input_bfd)->external_reloc_size; external_relocs_size = external_reloc_size * input_section->reloc_count; - external_relocs = bfd_malloc (external_relocs_size); - if (external_relocs == NULL && external_relocs_size != 0) + if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0) goto error_return; - - if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 - || (bfd_bread (external_relocs, external_relocs_size, input_bfd) - != external_relocs_size)) + external_relocs = _bfd_malloc_and_read (input_bfd, external_relocs_size, + external_relocs_size); + if (external_relocs == NULL && external_relocs_size != 0) goto error_return; /* Relocate the section contents. */ @@ -3909,18 +3858,14 @@ ecoff_indirect_link_order (bfd *output_bfd, output_section->reloc_count += input_section->reloc_count; } - if (contents != NULL) - free (contents); - if (external_relocs != NULL) - free (external_relocs); - return TRUE; + free (contents); + free (external_relocs); + return true; error_return: - if (contents != NULL) - free (contents); - if (external_relocs != NULL) - free (external_relocs); - return FALSE; + free (contents); + free (external_relocs); + return false; } /* Generate a reloc when linking an ECOFF file. This is a reloc @@ -3928,7 +3873,7 @@ ecoff_indirect_link_order (bfd *output_bfd, is used to build constructor and destructor tables when linking with -Ur. */ -static bfd_boolean +static bool ecoff_reloc_link_order (bfd *output_bfd, struct bfd_link_info *info, asection *output_section, @@ -3941,7 +3886,7 @@ ecoff_reloc_link_order (bfd *output_bfd, struct internal_reloc in; bfd_size_type external_reloc_size; bfd_byte *rbuf; - bfd_boolean ok; + bool ok; file_ptr pos; type = link_order->type; @@ -3956,7 +3901,7 @@ ecoff_reloc_link_order (bfd *output_bfd, if (rel.howto == 0) { bfd_set_error (bfd_error_bad_value); - return FALSE; + return false; } if (type == bfd_section_reloc_link_order) @@ -3969,10 +3914,10 @@ ecoff_reloc_link_order (bfd *output_bfd, struct bfd_link_hash_entry *h; /* Treat a reloc against a defined symbol as though it were - actually against the section. */ + 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)) @@ -3980,8 +3925,8 @@ ecoff_reloc_link_order (bfd *output_bfd, type = bfd_section_reloc_link_order; section = h->u.def.section->output_section; /* It seems that we ought to add the symbol value to the - addend here, but in practice it has already been added - because it was passed to constructor_callback. */ + addend here, but in practice it has already been added + because it was passed to constructor_callback. */ addend += section->vma + h->u.def.section->output_offset; } else @@ -4006,7 +3951,7 @@ ecoff_reloc_link_order (bfd *output_bfd, size = bfd_get_reloc_size (rel.howto); buf = (bfd_byte *) bfd_zmalloc (size); if (buf == NULL && size != 0) - return FALSE; + return false; rstat = _bfd_relocate_contents (rel.howto, output_bfd, (bfd_vma) addend, buf); switch (rstat) @@ -4020,7 +3965,7 @@ ecoff_reloc_link_order (bfd *output_bfd, (*info->callbacks->reloc_overflow) (info, NULL, (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (output_bfd, section) + ? bfd_section_name (section) : link_order->u.reloc.p->u.name), rel.howto->name, addend, NULL, NULL, (bfd_vma) 0); break; @@ -4029,14 +3974,13 @@ ecoff_reloc_link_order (bfd *output_bfd, (file_ptr) link_order->offset, size); free (buf); if (! ok) - return FALSE; + return false; } rel.addend = 0; /* Move the information into an internal_reloc structure. */ - in.r_vaddr = (rel.address - + bfd_get_section_vma (output_bfd, output_section)); + in.r_vaddr = rel.address + bfd_section_vma (output_section); in.r_type = rel.howto->type; if (type == bfd_symbol_reloc_link_order) @@ -4046,7 +3990,7 @@ ecoff_reloc_link_order (bfd *output_bfd, 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 != NULL && h->indx != -1) in.r_symndx = h->indx; @@ -4086,7 +4030,7 @@ ecoff_reloc_link_order (bfd *output_bfd, { _RCONST, RELOC_SECTION_RCONST } }; - name = bfd_get_section_name (output_bfd, section); + name = bfd_section_name (section); for (i = 0; i < ARRAY_SIZE (section_symndx); i++) if (streq (name, section_symndx[i].name)) @@ -4108,7 +4052,7 @@ ecoff_reloc_link_order (bfd *output_bfd, external_reloc_size = ecoff_backend (output_bfd)->external_reloc_size; rbuf = (bfd_byte *) bfd_malloc (external_reloc_size); if (rbuf == NULL) - return FALSE; + return false; (*ecoff_backend (output_bfd)->swap_reloc_out) (output_bfd, &in, (void *) rbuf); @@ -4129,36 +4073,36 @@ ecoff_reloc_link_order (bfd *output_bfd, /* Put out information for an external symbol. These come only from the hash table. */ -static bfd_boolean +static bool ecoff_link_write_external (struct bfd_hash_entry *bh, void * data) { struct ecoff_link_hash_entry *h = (struct ecoff_link_hash_entry *) bh; struct extsym_info *einfo = (struct extsym_info *) data; bfd *output_bfd = einfo->abfd; - bfd_boolean strip; + bool 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 == NULL) { @@ -4199,7 +4143,7 @@ ecoff_link_write_external (struct bfd_hash_entry *bh, void * data) }; output_section = h->root.u.def.section->output_section; - name = bfd_section_name (output_section->owner, output_section); + name = bfd_section_name (output_section); for (i = 0; i < ARRAY_SIZE (section_storage_classes); i++) if (streq (name, section_storage_classes[i].name)) @@ -4261,7 +4205,7 @@ ecoff_link_write_external (struct bfd_hash_entry *bh, void * data) 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 @@ -4280,7 +4224,7 @@ ecoff_link_write_external (struct bfd_hash_entry *bh, void * data) processes all the link order information. This may cause it to close and reopen some input BFDs; I'll see how bad this is. */ -bfd_boolean +bool _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) { const struct ecoff_backend_data * const backend = ecoff_backend (abfd); @@ -4325,14 +4269,14 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) handle = bfd_ecoff_debug_init (abfd, debug, &backend->debug_swap, info); if (handle == NULL) - return FALSE; + return false; /* Accumulate the debugging symbols from each input BFD. */ for (input_bfd = info->input_bfds; input_bfd != NULL; input_bfd = input_bfd->link.next) { - bfd_boolean ret; + bool ret; if (bfd_get_flavour (input_bfd) == bfd_target_ecoff_flavour) { @@ -4349,7 +4293,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) 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; @@ -4391,7 +4335,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) 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); @@ -4409,7 +4353,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) { 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 != NULL && h->type == bfd_link_hash_defined) ecoff_data (abfd)->gp = (h->u.def.value @@ -4452,25 +4396,25 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info) == 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; + abfd->symcount = symhdr->iextMax + symhdr->isymMax; - ecoff_data (abfd)->linker = TRUE; + ecoff_data (abfd)->linker = true; - return TRUE; + return true; }