bfd/
authorAlan Modra <amodra@gmail.com>
Tue, 25 Jan 2005 10:33:55 +0000 (10:33 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 25 Jan 2005 10:33:55 +0000 (10:33 +0000)
* elf.c (_bfd_elf_get_dynamic_reloc_upper_bound): Only include
loadable reloc sections.
(_bfd_elf_canonicalize_dynamic_reloc): Likewise.
(_bfd_elf_get_synthetic_symtab): Return 0 if no dynamic syms.
binutils/
* nm.c (display_rel_file): Read dynamic syms before calling
bfd_get_synthetic_symtab.

bfd/ChangeLog
bfd/elf.c
binutils/ChangeLog
binutils/nm.c

index 7a8352555904f980be4229cbc2a8d42d8b875f31..783865b2133d55bcd051f995d4aa8973b5a99b0b 100644 (file)
@@ -1,3 +1,10 @@
+2005-01-25  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf.c (_bfd_elf_get_dynamic_reloc_upper_bound): Only include
+       loadable reloc sections.
+       (_bfd_elf_canonicalize_dynamic_reloc): Likewise.
+       (_bfd_elf_get_synthetic_symtab): Return 0 if no dynamic syms.
+
 2005-01-25  Alan Modra  <amodra@bigpond.net.au>
 
        * elflink.c (elf_link_add_object_symbols): Don't create link dynamic
@@ -92,7 +99,7 @@
        BFD_HAVE_SYS_PROCFS_TYPE and BFD_HAVE_SYS_PROCFS_TYPE_MEMBER to
        the new file bfd.m4.  Include ../bfd/bfd.m4.
        * configure: Re-generate.
-       
+
 2005-01-12  Alan Modra  <amodra@bigpond.net.au>
 
        * elf32-ppc.c (ppc_elf_howto_raw): Delete RELAX32* entries.
index a3126b4640da53d57b5fbd57b9ac1c5b18b0c730..081ad8935e1f97312302d9614798a5d9af26fc96 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1,7 +1,7 @@
 /* ELF executable support for BFD.
 
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004 Free Software Foundation, Inc.
+   2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -5977,10 +5977,10 @@ _bfd_elf_canonicalize_dynamic_symtab (bfd *abfd,
   return symcount;
 }
 
-/* Return the size required for the dynamic reloc entries.  Any
-   section that was actually installed in the BFD, and has type
-   SHT_REL or SHT_RELA, and uses the dynamic symbol table, is
-   considered to be a dynamic reloc section.  */
+/* Return the size required for the dynamic reloc entries.  Any loadable
+   section that was actually installed in the BFD, and has type SHT_REL
+   or SHT_RELA, and uses the dynamic symbol table, is considered to be a
+   dynamic reloc section.  */
 
 long
 _bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd)
@@ -5996,7 +5996,8 @@ _bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd)
 
   ret = sizeof (arelent *);
   for (s = abfd->sections; s != NULL; s = s->next)
-    if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
+    if ((s->flags & SEC_LOAD) != 0
+       && elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
        && (elf_section_data (s)->this_hdr.sh_type == SHT_REL
            || elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
       ret += ((s->size / elf_section_data (s)->this_hdr.sh_entsize)
@@ -6005,14 +6006,13 @@ _bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd)
   return ret;
 }
 
-/* Canonicalize the dynamic relocation entries.  Note that we return
-   the dynamic relocations as a single block, although they are
-   actually associated with particular sections; the interface, which
-   was designed for SunOS style shared libraries, expects that there
-   is only one set of dynamic relocs.  Any section that was actually
-   installed in the BFD, and has type SHT_REL or SHT_RELA, and uses
-   the dynamic symbol table, is considered to be a dynamic reloc
-   section.  */
+/* Canonicalize the dynamic relocation entries.  Note that we return the
+   dynamic relocations as a single block, although they are actually
+   associated with particular sections; the interface, which was
+   designed for SunOS style shared libraries, expects that there is only
+   one set of dynamic relocs.  Any loadable section that was actually
+   installed in the BFD, and has type SHT_REL or SHT_RELA, and uses the
+   dynamic symbol table, is considered to be a dynamic reloc section.  */
 
 long
 _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd,
@@ -6033,7 +6033,8 @@ _bfd_elf_canonicalize_dynamic_reloc (bfd *abfd,
   ret = 0;
   for (s = abfd->sections; s != NULL; s = s->next)
     {
-      if (elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
+      if ((s->flags & SEC_LOAD) != 0
+         && elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
          && (elf_section_data (s)->this_hdr.sh_type == SHT_REL
              || elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
        {
@@ -7908,7 +7909,7 @@ long
 _bfd_elf_get_synthetic_symtab (bfd *abfd,
                               long symcount ATTRIBUTE_UNUSED,
                               asymbol **syms ATTRIBUTE_UNUSED,
-                              long dynsymcount ATTRIBUTE_UNUSED,
+                              long dynsymcount,
                               asymbol **dynsyms,
                               asymbol **ret)
 {
@@ -7924,10 +7925,14 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
   char *names;
   asection *plt;
 
+  *ret = NULL;
+
   if ((abfd->flags & (DYNAMIC | EXEC_P)) == 0)
     return 0;
 
-  *ret = NULL;
+  if (dynsymcount <= 0)
+    return 0;
+
   if (!bed->plt_sym_val)
     return 0;
 
index 368a76951704bd3c5624e9e5883f86e0445e9ea1..4756f0344ab39839be5fdbea896adf80e45816fe 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-25  Alan Modra  <amodra@bigpond.net.au>
+
+       * nm.c (display_rel_file): Read dynamic syms before calling
+       bfd_get_synthetic_symtab.
+
 2005-01-21  Ben Elliston  <bje@au.ibm.com>
 
        * dlltool.c (dump_iat): Remove unused function.
@@ -47,7 +52,7 @@
 
        * dlltool.c (set_dll_name_from_def): New function.  Strip name
        to basename, with warning.
-       (def_name): Use it. 
+       (def_name): Use it.
        (def_library): Likwise.
        (main): Strip arg of --dllname to basename, with warning.
        Only use basename of exp_name when inferring dll_name.
        decode_location_expression.
        (display_debug_frames): Pass 0 as the comp_unit offset to
        decode_location_expression.
-       
+
 2004-12-22  Nick Clifton  <nickc@redhat.com>
 
        * readelf.c (last_pointer_size, warned_about_missing_comp_units):
        of a 64-bit format .debug_ranges section.
        (display_debug_ranges): New function: Displays the contents of a
        32-bit .debug_ranges section.
-       
+
        (main): Move cmdline_dump_sects and num_cmdline_dump_sects into the
        global scope.
        (process_object): Initialise the dump_sects array from the
        get_debug_line_pointer_sizes.
        (display_debug_lines): Use the new functions.
        (display_debug_loc): Likewise.
-       
+
        (disassemble_section): Change return type to int.
        (display_debug_lines): Move local variables to their
        innermost scope.
 
        (debug_apply_rela_addends): Allow relocations against STT_OBJECT
        types as well.
-       
+
        * NEWS: Mention the support for decoding .debug_ranges sections.
        * doc/binutils.texi: Document the new command line switch to
        readelf.
index 3668d6b75e811e6f9ceab1a225b8a782b0cc6053..917137fecd55d7e4f84e3b1b9cc22441e411ee7d 100644 (file)
@@ -1,6 +1,6 @@
 /* nm.c -- Describe symbol table of a rel file.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004
+   2001, 2002, 2003, 2004, 2005
    Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
@@ -1026,8 +1026,18 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
        }
       else
        {
+         long storage = bfd_get_dynamic_symtab_upper_bound (abfd);
+
          static_count = symcount;
          static_syms = minisyms;
+
+         if (storage > 0)
+           {
+             dyn_syms = xmalloc (storage);
+             dyn_count = bfd_canonicalize_dynamic_symtab (abfd, dyn_syms);
+             if (dyn_count < 0)
+               bfd_fatal (bfd_get_filename (abfd));
+           }
        }
       synth_count = bfd_get_synthetic_symtab (abfd, static_count, static_syms,
                                              dyn_count, dyn_syms, &synthsyms);
This page took 0.042368 seconds and 4 git commands to generate.