MIPS ELF ld -Ur fails
H . J . Lu
hjl@lucon.org
Tue Oct 23 17:27:00 GMT 2001
On Tue, Oct 23, 2001 at 04:50:21PM -0700, Earl Chew wrote:
> "H . J . Lu" wrote:
> > I looked at the code. The problem is in elf_bfd_final_link,
> > elf_link_size_reloc_section is called before
> > bfd_section_reloc_link_order can update
> > elf_section_data(o)->rel_count.
>
> Did you consider my patch?
>
> Does it solve the underlying problem, or just paper over the bug?
I don't know.
>
> > How should we fix it?
>
> Regarding the nature of the problem, as I understand it, with
> things the way they stand, elf_section_reloc_link_order() cannot
> be called before elf_link_size_reloc_section() since the former
> assumes relocation array space has been allocated by the latter.
>
> In its current incarnation, elf_section_reloc_link_order()
> not only updates elf_section_data(o)->rel_count, it also
> modifies the relocation information.
>
> This means that elf_link_size_reloc_section() must be called
> before elf_section_reloc_link_order().
>
> However, the relocation space required by elf_section_reloc_link_order()
> is not accounted for when elf_link_size_reloc_section()
> allocates relocation space.
>
> If you look at the equivalent code in binutils-2.7 (which
> doesn't have the bug), I think you'll find that the count was
> held exclusively in o->reloc_count. Remnants of that code remain
> as the first loop in elf_bfd_final_link() which updates o->reloc_count.
>
I am not sure if we should even update o->reloc_count there.
H.J.
More information about the Binutils
mailing list