PATCH: PR ld/13909: PR ld/12570 causes eh_frame_hdr section to be sometimes too large
H.J. Lu
hjl.tools@gmail.com
Thu May 24 15:30:00 GMT 2012
On Thu, May 24, 2012 at 1:22 AM, Alan Modra <amodra@gmail.com> wrote:
> On Thu, May 24, 2012 at 12:01:26AM +0930, Alan Modra wrote:
>> PowerPC has a problem with ordering too, in that .eh_frame_hdr is
>> stripped when only PLT/glink has eh_frame info. I want to allow
>> sizing of the PLT/glink .eh_frame in elf_backend_size_dynamic_sections,
>> rather than sizing and filling in some data early like x86 does.
>
> HJ, how does this look to you? Moving _bfd_elf_maybe_strip_eh_frame_hdr
> later in bfd_elf_size_dynamic_sections allows us to treat the linker
> created PLT .eh_frame section like most other linker created sections.
> We don't need to set it up as early, nor do we rely on elf-eh-frame.c
> stripping the section by cunningly leaving an FDE range as zero.
>
> bfd/
> * elf-eh-frame.c (_bfd_elf_eh_frame_present): New function.
> (_bfd_elf_maybe_strip_eh_frame_hdr): Use it here.
> * elf-bfd.h (_bfd_elf_eh_frame_present): Declare.
> * elflink.c (bfd_elf_size_dynamic_sections): Let the backend
> size dynamic sections before stripping eh_frame_hdr.
> (bfd_elf_gc_sections): Handle multiple .eh_frame sections.
> * elf32-ppc.c (ppc_elf_size_dynamic_sections): Drop glink_eh_frame
> if no other .eh_frame sections exist.
> * elf64-ppc.c (ppc64_elf_size_stubs): Likewise.
> * elf32-i386.c (elf_i386_create_dynamic_sections): Don't size
> or alloc plt_eh_frame here..
> (elf_i386_size_dynamic_sections): ..do it here instead. Don't
> specially keep sgotplt, iplt, tgotplt, sdynbss for symbols.
> (elf_i386_finish_dynamic_sections): Check plt_eh_frame->contents
> before writing plt offset.
> * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Don't size
> or alloc plt_eh_frame here..
> (elf_x86_64_size_dynamic_sections): ..do it here instead.
> (elf_x86_64_finish_dynamic_sections): Check plt_eh_frame->contents
> before writing plt offset.
> ld/
> * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Handle
> multiple .eh_frame sections attached to bfd.
>
Works for me.
Thanks.
--
H.J.
More information about the Binutils
mailing list