aboutsummaryrefslogtreecommitdiff
path: root/bfd/ieee.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-03-30 22:15:07 +0000
committerIan Lance Taylor <ian@airs.com>1994-03-30 22:15:07 +0000
commit326e32d7ce8a83f59192657c48c9b9980466b939 (patch)
treea6d893226affe8172c0ad504e14f8aded908d849 /bfd/ieee.c
parent70f42bae0b1b4d71dfa1b0da6a29d1e82053b118 (diff)
downloadgdb-326e32d7ce8a83f59192657c48c9b9980466b939.zip
gdb-326e32d7ce8a83f59192657c48c9b9980466b939.tar.gz
gdb-326e32d7ce8a83f59192657c48c9b9980466b939.tar.bz2
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.
Diffstat (limited to 'bfd/ieee.c')
-rw-r--r--bfd/ieee.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 8683d7f..24b394e 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -586,7 +586,7 @@ get_symbol (abfd,
return last_symbol;
}
-static void
+static boolean
ieee_slurp_external_symbols (abfd)
bfd *abfd;
{
@@ -613,7 +613,8 @@ ieee_slurp_external_symbols (abfd)
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
&prev_symbols_ptr,
&ieee->external_symbol_max_index, 'D');
-
+ if (symbol == NULL)
+ return false;
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
@@ -626,7 +627,8 @@ ieee_slurp_external_symbols (abfd)
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
&prev_symbols_ptr,
&ieee->external_symbol_max_index, 'D');
-
+ if (symbol == NULL)
+ return false;
BFD_ASSERT (symbol->index >= ieee->external_symbol_min_index);
@@ -710,7 +712,8 @@ ieee_slurp_external_symbols (abfd)
symbol = get_symbol (abfd, ieee, symbol, &symbol_count,
&prev_reference_ptr,
&ieee->external_reference_max_index, 'X');
-
+ if (symbol == NULL)
+ return false;
symbol->symbol.the_bfd = abfd;
symbol->symbol.name = read_id (&(ieee->h));
@@ -760,24 +763,29 @@ ieee_slurp_external_symbols (abfd)
*prev_symbols_ptr = (ieee_symbol_type *) NULL;
*prev_reference_ptr = (ieee_symbol_type *) NULL;
+
+ return true;
}
-static void
+static boolean
ieee_slurp_symbol_table (abfd)
bfd *abfd;
{
if (IEEE_DATA (abfd)->read_symbols == false)
{
- ieee_slurp_external_symbols (abfd);
+ if (! ieee_slurp_external_symbols (abfd))
+ return false;
IEEE_DATA (abfd)->read_symbols = true;
}
+ return true;
}
-unsigned int
+long
ieee_get_symtab_upper_bound (abfd)
bfd *abfd;
{
- ieee_slurp_symbol_table (abfd);
+ if (! ieee_slurp_symbol_table (abfd))
+ return -1;
return (abfd->symcount != 0) ?
(abfd->symcount + 1) * (sizeof (ieee_symbol_type *)) : 0;
@@ -790,7 +798,7 @@ symbol index order
extern bfd_target ieee_vec;
-unsigned int
+long
ieee_get_symtab (abfd, location)
bfd *abfd;
asymbol **location;
@@ -805,7 +813,8 @@ ieee_get_symtab (abfd, location)
{
ieee_data_type *ieee = IEEE_DATA (abfd);
dummy_bfd.xvec = &ieee_vec;
- ieee_slurp_symbol_table (abfd);
+ if (! ieee_slurp_symbol_table (abfd))
+ return -1;
if (ieee->symbol_table_full == false)
{
@@ -1684,12 +1693,13 @@ ieee_new_section_hook (abfd, newsect)
return true;
}
-unsigned int
+long
ieee_get_reloc_upper_bound (abfd, asect)
bfd *abfd;
sec_ptr asect;
{
- ieee_slurp_section_data (abfd);
+ if (! ieee_slurp_section_data (abfd))
+ return -1;
return (asect->reloc_count + 1) * sizeof (arelent *);
}
@@ -1707,7 +1717,7 @@ ieee_get_section_contents (abfd, section, location, offset, count)
return true;
}
-unsigned int
+long
ieee_canonicalize_reloc (abfd, section, relptr, symbols)
bfd *abfd;
sec_ptr section;
@@ -3310,6 +3320,11 @@ ieee_bfd_debug_info_accumulate (abfd, section)
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ieee_bfd_final_link _bfd_generic_final_link
+#define ieee_bfd_copy_private_section_data \
+ ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
+#define ieee_bfd_copy_private_bfd_data \
+ ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
+#define ieee_bfd_is_local_label bfd_generic_is_local_label
/*SUPPRESS 460 */
bfd_target ieee_vec =