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: 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


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