PR binutils/14444
authorAlan Modra <amodra@gmail.com>
Fri, 10 Aug 2012 02:14:50 +0000 (02:14 +0000)
committerAlan Modra <amodra@gmail.com>
Fri, 10 Aug 2012 02:14:50 +0000 (02:14 +0000)
* elf.c (IS_VALID_GROUP_SECTION_HEADER) Add minsize param.
(setup_group): Adjust uses.
(bfd_section_from_shdr): Allow SHT_GROUP sections with just a flag
word.

bfd/ChangeLog
bfd/elf.c

index af00be77bc0397281b7ee7b1323dac3914a26c56..b1dcf8607cd6eaa6b3383d984a66284aded0c050 100644 (file)
@@ -1,3 +1,11 @@
+2012-08-10  Alan Modra  <amodra@gmail.com>
+
+       PR binutils/14444
+       * elf.c (IS_VALID_GROUP_SECTION_HEADER) Add minsize param.
+       (setup_group): Adjust uses.
+       (bfd_section_from_shdr): Allow SHT_GROUP sections with just a flag
+       word.
+
 2012-08-09  Nick Clifton  <nickc@redhat.com>
 
        * po/vi.po: Updated Vietnamese translation.
        * dwarf2.c (struct line_info): Add discriminator field.
        (add_line_info): Fill in new discriminator field.
        (decode_line_info): Record discriminator information instead
-        of ignoring it.
+       of ignoring it.
        (lookup_address_in_line_info_table): Return discriminator field if
-        requested.
+       requested.
        (comp_unit_find_nearest_line): Add discriminator argument.
        (find_line): Likewise.
        (_bfd_dwarf2_find_nearest_line): Likewise.
        (_bfd_dwarf2_find_line): Likewise.
        * elf-bfd.h (_bfd_elf_find_nearest_line_discriminator): New.
-        (_bfd_elf_find_line_discriminator): Likewise.
-        (_bfd_generic_find_nearest_line_discriminator): Likewise. Defined.
+       (_bfd_elf_find_line_discriminator): Likewise.
+       (_bfd_generic_find_nearest_line_discriminator): Likewise. Defined.
        * elf.c (_bfd_elf_find_nearest_line): Change to a wrapper
-        that invokes _bfd_elf_find_nearest_line_discriminator with correct
-        arguments.
+       that invokes _bfd_elf_find_nearest_line_discriminator with correct
+       arguments.
        (_bfd_elf_find_nearest_line_discriminator): New.
        (_bfd_elf_find_line): Change to a wrapper
-        that invokes _bfd_elf_find_line_discriminator with correct
-        arguments.
+       that invokes _bfd_elf_find_line_discriminator with correct
+       arguments.
        (_bfd_elf_find_line_discriminator): New.
        * coffgen.c (coff_find_nearest_line_with_names): Handle
-        new discriminator argument.
+       new discriminator argument.
        * elf32-arm.c (elf32_arm_find_nearest_line): Likewise.
        * elf64-alpha.c (elf64_alpha_find_nearest_line): Likewise.
        * elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Likewise.
        * mach-o.c (bfd_mach_o_find_nearest_line): Likewise.
        * libbfd-in.h (_bfd_dwarf2_find_nearest_line): Add discriminator
-        argument.
-        (_bfd_dwarf2_find_line): Likewise.
-        (_bfd_generic_find_nearest_line_discriminator): New.
+       argument.
+       (_bfd_dwarf2_find_line): Likewise.
+       (_bfd_generic_find_nearest_line_discriminator): New.
        * libbfd.c (_bfd_generic_find_nearest_line_discriminator): New.
        * bfd-in2.h: Regenerated.
        * libbfd.h: Likewise.
        * targets.c (BFD_JUMP_TABLE_SYMBOLS): Initialize
-        _bfd_find_nearest_line_discriminator with
-        _bfd_generic_find_nearest_line_discriminator.
-        (bfd_target): Add _bfd_find_nearest_line_discriminator.
+       _bfd_find_nearest_line_discriminator with
+       _bfd_generic_find_nearest_line_discriminator.
+       (bfd_target): Add _bfd_find_nearest_line_discriminator.
 
 2012-07-24  Sean Keys  <skeys@ipdatasys.com>
 
-        * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Added code
+       * elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Added code
        that enables the linker to offset addresses, when linking against
-        symbols from the XGATE processor and vice versa.
+       symbols from the XGATE processor and vice versa.
 
 2012-07-23  Nick Clifton  <nickc@redhat.com>
 
 2012-05-23  Alan Modra  <amodra@gmail.com>
 
        * elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Handle
-        BFDs with multiple .eh_frame sections.
+       BFDs with multiple .eh_frame sections.
 
 2012-05-23  Alan Modra  <amodra@gmail.com>
 
 
 2012-05-16  Alan Modra  <amodra@gmail.com>
 
-       PR ld/13962
-       PR ld/7023
+       PR ld/13962
+       PR ld/7023
        * elf.c (bfd_section_from_shdr): Fail when .dynsym sh_info is
        out of range.  As a special case, fix sh_info for zero sh_size.
        Do the same for .symtab.
index 0ac4032b699cb0a703a41b896ec403ac8b04b178..0208e05ec1fdcc08f109e45c18ef217403ecb1d6 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -545,9 +545,9 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
       shnum = elf_numsections (abfd);
       num_group = 0;
 
-#define IS_VALID_GROUP_SECTION_HEADER(shdr)            \
+#define IS_VALID_GROUP_SECTION_HEADER(shdr, minsize)   \
        (   (shdr)->sh_type == SHT_GROUP                \
-        && (shdr)->sh_size >= (2 * GRP_ENTRY_SIZE)     \
+        && (shdr)->sh_size >= minsize                  \
         && (shdr)->sh_entsize == GRP_ENTRY_SIZE        \
         && ((shdr)->sh_size % GRP_ENTRY_SIZE) == 0)
 
@@ -555,7 +555,7 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
        {
          Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
 
-         if (IS_VALID_GROUP_SECTION_HEADER (shdr))
+         if (IS_VALID_GROUP_SECTION_HEADER (shdr, 2 * GRP_ENTRY_SIZE))
            num_group += 1;
        }
 
@@ -581,7 +581,7 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
            {
              Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
 
-             if (IS_VALID_GROUP_SECTION_HEADER (shdr))
+             if (IS_VALID_GROUP_SECTION_HEADER (shdr, 2 * GRP_ENTRY_SIZE))
                {
                  unsigned char *src;
                  Elf_Internal_Group *dest;
@@ -1929,7 +1929,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
       return TRUE;
 
     case SHT_GROUP:
-      if (! IS_VALID_GROUP_SECTION_HEADER (hdr))
+      if (! IS_VALID_GROUP_SECTION_HEADER (hdr, GRP_ENTRY_SIZE))
        return FALSE;
       if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
        return FALSE;