This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Bug in >64k-section ELF handling when linking (with -r)
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: amodra at bigpond dot net dot au
- Cc: hans-peter dot nilsson at axis dot com, binutils at sources dot redhat dot com
- Date: Sun, 3 Nov 2002 03:59:31 +0100
- Subject: Re: Bug in >64k-section ELF handling when linking (with -r)
> Date: Sat, 2 Nov 2002 23:12:40 +1030
> From: Alan Modra <amodra@bigpond.net.au>
> Oh dear. elf_bfd_final_link sets up symtab_hdr but not
> symtab_shndx_hdr.
Looking closer, doing that doesn't look right to me:
> off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, true);
...
> + off = _bfd_elf_assign_file_position_for_section (symtab_shndx_hdr,
...
> /* Note that at this point elf_tdata (abfd)->next_file_pos is
> incorrect. We do not yet know the size of the .symtab section.
To wit, there's a call to _bfd_elf_assign_file_position_for_section
inserted *after* the _bfd_elf_assign_file_position_for_section
call for the .symtab section, but *before* the comment that
referred to the first call; the comment that says "Note that at
this point elf_tdata (abfd)->next_file_pos is incorrect. We do
not yet know the size of the .symtab section."
I think it'd be better to just keep the finfo->symshndxbuf array
in-core, and flush it out separately after the symbols are
output, adjusting code to handle it being out-of-sync with
finfo->symbuf.
> This patch adds two test-cases. Note that it takes a few
> minutes to even get to ldwrite on a 1GHz Athlon model 4 for the
> -r case. (Performance problem; todo for another day I guess.)
That is, if one considers orphaned sections a common case;
breaking in gdb reveals the orphaned-section-placement code.
Orphaned sections *is* the common case with -r, if more than
just the usual .text .data .rodata etc are used. Maybe it can
qualify as a "don't do that, then", but it's common enough to
use -r that it seems worth speeding up.
brgds, H-P