This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]