This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/12730: regression] crash when allocating in a static constructor
On Fri, May 06, 2011 at 09:16:20AM -0700, H.J. Lu wrote:
> How about this patch?
Much better, thanks. But,
> * elf.c (_bfd_elf_section_reloc_offset): New.
why not put your changes in _bfd_elf_section_offset?
> * elf64-x86-64.c (elf_x86_64_relocate_section): Call
> _bfd_elf_section_reloc_offset instead of
> _bfd_elf_section_offset.
> * elfxx-ia64.c (elfNN_ia64_install_dyn_reloc): Likewise.
The world is more than just Intel.. Every other ELF target will need
the same as you've done for x86_64 and ia64, and it would be better to
reverse relocs even for REL targets just in case you have a reloc
against a global sym.
> + /* We need to reverse-copy input .ctors/.dtors sections if
> + they are placed in .init_array/.finit_array for output. */
> + if (o->size > address_size
> + && ((strcmp (o->name, ".ctors") == 0
strncmp (o->name, ".ctors", 6) == 0
&& (o->name[6] == 0 || o->name[6] == '.')
Ditto for dtors, or explain to me why not. Seems to me that .ctors.nn
section could possibly have more than one constructor.
--
Alan Modra
Australia Development Lab, IBM