PR ld/12887
authorAlan Modra <amodra@gmail.com>
Tue, 14 Jun 2011 12:57:18 +0000 (12:57 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 14 Jun 2011 12:57:18 +0000 (12:57 +0000)
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Check sec_info_type
before doing anything.
(_bfd_elf_discard_section_eh_frame): Likewise.

bfd/ChangeLog
bfd/elf-eh-frame.c

index 0c3dfdf88c482d924532468aa42cebc0dc449c44..0fd8e4f0b293627d8639aa4afe1a3af15412e2ee 100644 (file)
@@ -1,3 +1,10 @@
+2011-06-14  Alan Modra  <amodra@gmail.com>
+
+       PR ld/12887
+       * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Check sec_info_type
+       before doing anything.
+       (_bfd_elf_discard_section_eh_frame): Likewise.
+
 2011-06-14  Alan Modra  <amodra@gmail.com>
 
        * Makefile.am: Formatting.
index 0a2213814743be0a25948e5d59e58903fc1006df..21041a5b408fd0418375017ff7549f27a28b0b40 100644 (file)
@@ -1,5 +1,5 @@
 /* .eh_frame section optimization.
-   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Written by Jakub Jelinek <jakub@redhat.com>.
 
@@ -490,7 +490,8 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
   if (hdr_info->parsed_eh_frames)
     return;
 
-  if (sec->size == 0)
+  if (sec->size == 0
+      || sec->sec_info_type != ELF_INFO_TYPE_NONE)
     {
       /* This file does not contain .eh_frame information.  */
       return;
@@ -1133,6 +1134,9 @@ _bfd_elf_discard_section_eh_frame
   struct eh_frame_hdr_info *hdr_info;
   unsigned int ptr_size, offset;
 
+  if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+    return FALSE;
+
   sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info;
   if (sec_info == NULL)
     return FALSE;