PATCH: PR ld/13909: PR ld/12570 causes eh_frame_hdr section to be sometimes too large

Alan Modra amodra@gmail.com
Wed May 23 04:38:00 GMT 2012


On Tue, May 22, 2012 at 09:16:22AM -0700, H.J. Lu wrote:
> 	* elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Ignore
> 	.eh_frame section created by linker.

We do need this here.

	* elf-eh-frame.c (_bfd_elf_maybe_strip_eh_frame_hdr): Handle
        BFDs with multiple .eh_frame sections.

Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.88
diff -u -p -r1.88 elf-eh-frame.c
--- bfd/elf-eh-frame.c	24 Apr 2012 05:12:30 -0000	1.88
+++ bfd/elf-eh-frame.c	23 May 2012 04:08:28 -0000
@@ -1278,7 +1278,11 @@ _bfd_elf_maybe_strip_eh_frame_hdr (struc
 	/* Count only sections which have at least a single CIE or FDE.
 	   There cannot be any CIE or FDE <= 8 bytes.  */
 	o = bfd_get_section_by_name (abfd, ".eh_frame");
-	if (o && o->size > 8 && !bfd_is_abs_section (o->output_section))
+	while (o != NULL
+	       && (o->size <= 8
+		   || bfd_is_abs_section (o->output_section)))
+	  o = bfd_get_next_section_by_name (o);
+	if (o != NULL)
 	  break;
       }
 

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list