From 326e32d7ce8a83f59192657c48c9b9980466b939 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 30 Mar 1994 22:15:07 +0000 Subject: Wed Mar 30 16:25:41 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) Changes to let BFD return an error indication from get_symtab_upper_bound, bfd_canonicalize_symtab, bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now return long instead of unsigned int, and use -1 to indicate an error. Along the way, rename get_symtab_upper_bound to bfd_get_symtab_upper_bound. * bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on errors. (bfd_canonicalize_reloc): Likewise. * syms.c (bfd_get_symtab_upper_bound): Renamed from get_symtab_upper_bound. * targets.c (bfd_target): Renamed _get_symtab_upper_bound to _bfd_get_symtab_upper_bound, and changed it and _bfd_canonicalize_symtab and _get_reloc_upper_bound and _bfd_canonicalize_reloc to all return long. * aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors. (NAME(aout,canonicalize_reloc)): Likewise. (NAME(aout,get_reloc_upper_bound)): Likewise. (NAME(aout,get_symtab_upper_bound)): Likewise. * bout.c (b_out_canonicalize_reloc): Likewise. (b_out_get_reloc_upper_bound): Likewise. * coffcode.h (coff_canonicalize_reloc): Likewise. * coffgen.c (coff_get_symtab_upper_bound): Likewise. (coff_get_symtab): Likewise. (coff_get_reloc_upper_bound): Likewise. * ecoff.c (ecoff_get_symtab_upper_bound): Likewise. (ecoff_get_symtab): Likewise. (ecoff_canonicalize_reloc): Likewise. * elfcode.h (elf_get_symtab_upper_bound): Likewise. (elf_get_reloc_upper_bound): Likewise. (elf_canonicalize_reloc): Likewise. (elf_get_symtab): Likewise. * hp300hpux.c (MY(get_symtab)): Likewise. (MY(get_symtab_upper_bound)): Likewise. (MY(canonicalize_reloc)): Likewise. * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise. * ieee.c (ieee_slurp_external_symbols): Change return type to boolean. Check for errors from get_symbol. (ieee_slurp_symbol_table): Change return type to boolean. Check for errors from ieee_slurp_external_symbols. (ieee_get_symtab_upper_bound): Return long, and -1 on errors. (ieee_get_symtab): Likewise. (ieee_get_reloc_upper_bound): Likewise. (ieee_canonicalize_reloc): Likewise. * mipsbsd.c (MY(canonicalize_reloc)): Likewise. * nlmcode.h (nlm_get_symtab_upper_bound): Likewise. (nlm_get_symtab): Likewise. (nlm_get_reloc_upper_bound): Likewise. (nlm_canonicalize_reloc): Likewise. * oasys.c (oasys_get_symtab_upper_bound): Likewise. (oasys_get_symtab): Likewise. (oasys_get_reloc_upper_bound): Likewise. (oasys_canonicalize_reloc): Likewise. * som.c (som_get_symtab_upper_bound): Likewise. (som_get_symtab): Likewise. (som_get_reloc_upper_bound): Likewise. (som_canonicalize_reloc): Likewise. * srec.c (srec_get_symtab_upper_bound): Likewise. (srec_get_symtab): Likewise. (srec_get_reloc_upper_bound): Define as bfd_0l. (srec_canonicalize_reloc): Likewise. * tekhex.c (tekhex_get_symtab): Return long, and -1 on errors. (tekhex_get_symtab_upper_bound): Likewise. (tekhex_get_reloc_upper_bound): Define as bfd_0l. (tekhex_canonicalize_reloc): Likewise. * libaout.h (NAME(aout,get_symtab_upper_bound)): Change declaration to return long. (NAME(aout,get_symtab)): Likewise. (NAME(aout,canonicalize_reloc)): Likewise. (NAME(aout,get_reloc_upper_bound)): Likewise. * libcoff-in.h (coff_get_symtab_upper_bound): Likewise. (coff_get_symtab): Likewise. (coff_get_reloc_upper_bound): Likewise. * libecoff.h (ecoff_get_symtab_upper_bound): Likewise. (ecoff_get_symtab): Likewise. (ecoff_canonicalize_reloc): Likewise. * libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise. (bfd_elf32_get_symtab): Likewise. (bfd_elf32_get_reloc_upper_bound): Likewise. (bfd_elf32_canonicalize_reloc): Likewise. (bfd_elf64_get_symtab_upper_bound): Likewise. (bfd_elf64_get_symtab): Likewise. (bfd_elf64_get_reloc_upper_bound): Likewise. (bfd_elf64_canonicalize_reloc): Likewise. * libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise. (nlmNAME(get_symtab)): Likewise. (nlmNAME(get_reloc_upper_bound)): Likewise. (nlmNAME(canonicalize_reloc)): Likewise. * archive.c (compute_and_write_armap): Use error_return and no_memory_return labels rather than freeing information in various places. Change storage, symcount and src_count to long. Check errors from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab. * bout.c (b_out_relax_section): Change reloc_size to long. Check for errors from bfd_get_reloc_upper_bound and bfd_canonicalize_reloc. (b_out_get_relocated_section_contents): Likewise. * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Likewise. * elf32-mips.c: Likewise. * elf32-hppa.c (hppa_elf_stub_finish): Likewise. (hppa_look_for_stubs_in_section): Check for errors from bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and bfd_canonicalize_reloc. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab. * linker.c (generic_link_read_symbols): Likewise. (_bfd_generic_final_link): Check for errors from bfd_get_reloc_upper_bound and bfd_canonicalize_reloc. * reloc.c (bfd_generic_get_relocated_section_contents): Likewise. * reloc16.c (bfd_coff_reloc16_relax_section): Likewise. (bfd_coff_reloc16_get_relocated_section_contents): Likewise. * libbfd.c (bfd_0l): New function. * libbfd-in.h (bfd_0l): Declare. * aix386-core.c: Change get_symtab_upper_bound, get_symtab, get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather than bfd_0u. * cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise. * irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise. * bfd-in2.h: Rebuilt. * libbfd.h: Rebuilt. * libcoff.h: Rebuilt. * nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables temp and name. --- bfd/som.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'bfd/som.c') diff --git a/bfd/som.c b/bfd/som.c index 6fa3f8b..7d56537 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -138,16 +138,16 @@ static bfd_target * som_object_p PARAMS ((bfd *)); static boolean som_write_object_contents PARAMS ((bfd *)); static boolean som_slurp_string_table PARAMS ((bfd *)); static unsigned int som_slurp_symbol_table PARAMS ((bfd *)); -static unsigned int som_get_symtab_upper_bound PARAMS ((bfd *)); -static unsigned int som_canonicalize_reloc PARAMS ((bfd *, sec_ptr, - arelent **, asymbol **)); -static unsigned int som_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); +static long som_get_symtab_upper_bound PARAMS ((bfd *)); +static long som_canonicalize_reloc PARAMS ((bfd *, sec_ptr, + arelent **, asymbol **)); +static long som_get_reloc_upper_bound PARAMS ((bfd *, sec_ptr)); static unsigned int som_set_reloc_info PARAMS ((unsigned char *, unsigned int, arelent *, asection *, asymbol **, boolean)); static boolean som_slurp_reloc_table PARAMS ((bfd *, asection *, asymbol **, boolean)); -static unsigned int som_get_symtab PARAMS ((bfd *, asymbol **)); +static long som_get_symtab PARAMS ((bfd *, asymbol **)); static asymbol * som_make_empty_symbol PARAMS ((bfd *)); static void som_print_symbol PARAMS ((bfd *, PTR, asymbol *, bfd_print_symbol_type)); @@ -3544,12 +3544,12 @@ som_slurp_string_table (abfd) /* Return the amount of data (in bytes) required to hold the symbol table for this object. */ -static unsigned int +static long som_get_symtab_upper_bound (abfd) bfd *abfd; { if (!som_slurp_symbol_table (abfd)) - return 0; + return -1; return (bfd_get_symcount (abfd) + 1) * (sizeof (asymbol *)); } @@ -3774,7 +3774,7 @@ som_slurp_symbol_table (abfd) /* Canonicalize a SOM symbol table. Return the number of entries in the symbol table. */ -static unsigned int +static long som_get_symtab (abfd, location) bfd *abfd; asymbol **location; @@ -3783,7 +3783,7 @@ som_get_symtab (abfd, location) som_symbol_type *symbase; if (!som_slurp_symbol_table (abfd)) - return 0; + return -1; i = bfd_get_symcount (abfd); symbase = obj_som_symtab (abfd); @@ -4169,7 +4169,7 @@ som_slurp_reloc_table (abfd, section, symbols, just_count) /* Return the number of bytes required to store the relocation information associated with the given section. */ -static unsigned int +static long som_get_reloc_upper_bound (abfd, asect) bfd *abfd; sec_ptr asect; @@ -4178,18 +4178,18 @@ som_get_reloc_upper_bound (abfd, asect) and parse it to determine how many relocations exist. */ if (asect->flags & SEC_RELOC) { - if (som_slurp_reloc_table (abfd, asect, NULL, true)) - return (asect->reloc_count + 1) * sizeof (arelent); + if (! som_slurp_reloc_table (abfd, asect, NULL, true)) + return false; + return (asect->reloc_count + 1) * sizeof (arelent); } - /* Either there are no relocations or an error occurred while - reading and parsing the relocation stream. */ + /* There are no relocations. */ return 0; } /* Convert relocations from SOM (external) form into BFD internal form. Return the number of relocations. */ -static unsigned int +static long som_canonicalize_reloc (abfd, section, relptr, symbols) bfd *abfd; sec_ptr section; @@ -4200,12 +4200,12 @@ som_canonicalize_reloc (abfd, section, relptr, symbols) int count; if (som_slurp_reloc_table (abfd, section, symbols, false) == false) - return 0; + return -1; count = section->reloc_count; tblptr = section->relocation; if (tblptr == (arelent *) NULL) - return 0; + return -1; while (count--) *relptr++ = tblptr++; -- cgit v1.1