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 16:02:52 +0100
- Subject: Re: Bug in >64k-section ELF handling when linking (with -r)
> Date: Mon, 4 Nov 2002 00:33:15 +1030
> From: Alan Modra <amodra@bigpond.net.au>
> The following hasn't yet been tested properly as I hit
> a segfault due to freeing a buffer twice, and I'm not delaying
> bedtime another half hour for my testcase to link again..
> * elflink.h (struct elf_final_link_info): Add shndxbuf_size.
> (elf_bfd_final_link): Don't bother zeroing symtab_hdr fields.
> Set up a larger symshndxbuf, and write it out. Free it on
> exit rather than freeing symbuf twice.
> (elf_link_output_sym): Accumulate symbol extension section
> indices, reallocating symshndxbuf rather than writing it out.
> (elf_link_flush_output_syms): Don't flush symshndxbuf.
I tweaked your previous patch and have almost the same patch as
that one except for zeroing symshndxbuf (bfd_zmalloc and memset 0
after realloc), having adjustments in elf_link_flush_output_syms
rather than elf_link_output_sym; realloc:ing symshndxbuf as new
symtab chunks are flushed (no shndxbuf_size). I get a
bfd_assert instead of the SEGV you get. :-) I'll post that one,
valgrind:ed and dmalloc:ed when it passes tests, if only because
it zeroes .symtab_shndx.
brgds, H-P