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:36:00 GMT 2012


On Tue, May 22, 2012 at 09:16:22AM -0700, H.J. Lu wrote:
> How about this patch?

No, this is just papering over the real problem.  The testcase is
  ld -shared --eh-frame-hdr -o empty.so -lc empty.o
a quite contrived situation that leads to ld having htab->dynobj as
-lc, so (htab->dynobj->flags & DYNAMIC) != 0.  bfd_elf_discard_info
then ignores the linker created PLT eh_frame.

I'd be inclined to just close pr13909 as wontfix, except that the fix
is quite easy.  bfd_elf_discard_info has no need to check for dynamic
bfds since their sections are removed with bfd_section_list_clear in
elf_link_add_object_symbols.

	PR ld/13909
	* elflink.c (bfd_elf_discard_info): Don't ignore dynamic BFDs.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.443
diff -u -p -r1.443 elflink.c
--- bfd/elflink.c	22 May 2012 14:58:15 -0000	1.443
+++ bfd/elflink.c	23 May 2012 04:08:34 -0000
@@ -12482,9 +12482,6 @@ bfd_elf_discard_info (bfd *output_bfd, s
 
       bed = get_elf_backend_data (abfd);
 
-      if ((abfd->flags & DYNAMIC) != 0)
-	continue;
-
       eh = NULL;
       if (!info->relocatable)
 	{

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list