* elfcode.h (elf_swap_symbol_in): Return bfd_boolean. Don't abort
authorAlan Modra <amodra@gmail.com>
Fri, 22 Sep 2006 13:16:45 +0000 (13:16 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 22 Sep 2006 13:16:45 +0000 (13:16 +0000)
on error.
* elf-bfd.h (elf_size_info <swap_symbol_in>): Adjust decl.
(bfd_elf32_swap_symbol_in, bfd_elf64_swap_symbol_in): Likewise.
* elf.c (bfd_elf_get_elf_syms): Test return of swap_symbol_in,
and report error.
* elf32-arm.c (elf32_arm_swap_symbol_in): Return bfd_boolean.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
bfd/elf32-arm.c
bfd/elfcode.h

index 9602cf070107e8e2947bc912843f7e869360c3b8..bd6aed7fb052bfeb60c30f0d6eae035c5b20e9ce 100644 (file)
@@ -1,3 +1,13 @@
+2006-09-22  Alan Modra  <amodra@bigpond.net.au>
+
+       * elfcode.h (elf_swap_symbol_in): Return bfd_boolean.  Don't abort
+       on error.
+       * elf-bfd.h (elf_size_info <swap_symbol_in>): Adjust decl.
+       (bfd_elf32_swap_symbol_in, bfd_elf64_swap_symbol_in): Likewise.
+       * elf.c (bfd_elf_get_elf_syms): Test return of swap_symbol_in,
+       and report error.
+       * elf32-arm.c (elf32_arm_swap_symbol_in): Return bfd_boolean.
+
 2006-09-20  Martin Schwidefsky  <schwidefsky@de.ibm.com>
 
        * elf32-s390.c (elf_s390_relocate_section): Remove check for code
index 32b381c8adad60e3a69567b2cbcb7ad0ea65b9e8..da0eb72e1cb54df2b720e5000bcf5ae80476ba6d 100644 (file)
@@ -468,7 +468,7 @@ struct elf_size_info {
     (*write_shdrs_and_ehdr) (bfd *);
   void (*write_relocs)
     (bfd *, asection *, void *);
-  void (*swap_symbol_in)
+  bfd_boolean (*swap_symbol_in)
     (bfd *, const void *, const void *, Elf_Internal_Sym *);
   void (*swap_symbol_out)
     (bfd *, const Elf_Internal_Sym *, void *, void *);
@@ -1744,7 +1744,7 @@ extern int bfd_elf32_core_file_failing_signal
 extern bfd_boolean bfd_elf32_core_file_matches_executable_p
   (bfd *, bfd *);
 
-extern void bfd_elf32_swap_symbol_in
+extern bfd_boolean bfd_elf32_swap_symbol_in
   (bfd *, const void *, const void *, Elf_Internal_Sym *);
 extern void bfd_elf32_swap_symbol_out
   (bfd *, const Elf_Internal_Sym *, void *, void *);
@@ -1786,7 +1786,7 @@ extern int bfd_elf64_core_file_failing_signal
 extern bfd_boolean bfd_elf64_core_file_matches_executable_p
   (bfd *, bfd *);
 
-extern void bfd_elf64_swap_symbol_in
+extern bfd_boolean bfd_elf64_swap_symbol_in
   (bfd *, const void *, const void *, Elf_Internal_Sym *);
 extern void bfd_elf64_swap_symbol_out
   (bfd *, const Elf_Internal_Sym *, void *, void *);
index 8ce0933ad958d466b8e85227de3d5aaa4433ece3..73a8713e218334000c7e4bc2c1b74c068a2c902f 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -400,7 +400,15 @@ bfd_elf_get_elf_syms (bfd *ibfd,
   for (esym = extsym_buf, isym = intsym_buf, shndx = extshndx_buf;
        isym < isymend;
        esym += extsym_size, isym++, shndx = shndx != NULL ? shndx + 1 : NULL)
-    (*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym);
+    if (!(*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym))
+      {
+       symoffset += (esym - (bfd_byte *) extsym_buf) / extsym_size;
+       (*_bfd_error_handler) (_("%B symbol number %lu references "
+                                "nonexistent SHT_SYMTAB_SHNDX section"),
+                              ibfd, (unsigned long) symoffset);
+       intsym_buf = NULL;
+       goto out;
+      }
 
  out:
   if (alloc_ext != NULL)
index f46b6ae58bc711e402be85e7d0e5329b4827ba95..337f959878d37857dca9b8da788c34cef35036cd 100644 (file)
@@ -9338,13 +9338,14 @@ elf32_arm_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED,
 
 /* Mangle thumb function symbols as we read them in.  */
 
-static void
+static bfd_boolean
 elf32_arm_swap_symbol_in (bfd * abfd,
                          const void *psrc,
                          const void *pshn,
                          Elf_Internal_Sym *dst)
 {
-  bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst);
+  if (!bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst))
+    return FALSE;
 
   /* New EABI objects mark thumb function symbols by setting the low bit of
      the address.  Turn these into STT_ARM_TFUNC.  */
@@ -9354,6 +9355,7 @@ elf32_arm_swap_symbol_in (bfd * abfd,
       dst->st_info = ELF_ST_INFO (ELF_ST_BIND (dst->st_info), STT_ARM_TFUNC);
       dst->st_value &= ~(bfd_vma) 1;
     }
+  return TRUE;
 }
 
 
index a285a133088321287e98baf78eb83222c8242ba2..d58cf344718304d834ec0d3744d70f38f83f7b63 100644 (file)
@@ -166,7 +166,7 @@ static void elf_debug_file (Elf_Internal_Ehdr *);
 /* Translate an ELF symbol in external format into an ELF symbol in internal
    format.  */
 
-void
+bfd_boolean
 elf_swap_symbol_in (bfd *abfd,
                    const void *psrc,
                    const void *pshn,
@@ -188,9 +188,10 @@ elf_swap_symbol_in (bfd *abfd,
   if (dst->st_shndx == SHN_XINDEX)
     {
       if (shndx == NULL)
-       abort ();
+       return FALSE;
       dst->st_shndx = H_GET_32 (abfd, shndx->est_shndx);
     }
+  return TRUE;
 }
 
 /* Translate an ELF symbol in internal format into an ELF symbol in external
This page took 0.038998 seconds and 4 git commands to generate.