This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Re: The problem with linkonce sections in ELF
- To: hjl at valinux dot com
- Subject: Re: The problem with linkonce sections in ELF
- From: Ian Lance Taylor <ian at zembu dot com>
- Date: 1 Feb 2000 16:24:50 -0500
- CC: binutils at sourceware dot cygnus dot com
- References: <20000131184519.A14245@valinux.com> <20000201042719.11854.qmail@daffy.airs.com> <20000201131850.A22685@valinux.com>
Date: Tue, 1 Feb 2000 13:18:50 -0800
From: "H . J . Lu" <hjl@valinux.com>
On Mon, Jan 31, 2000 at 11:27:19PM -0500, Ian Lance Taylor wrote:
> Duplicate linkonce sections are removed before section addresses are
> assigned, so they should not leave any holes in the address space.
> If they do leave holes in the address space, that is definitely a bug.
> Do you have any reason to think that that is happening?
You are right. It is .rel.text and .rel.text which cause the problem.
When they are removed, they leave a hole in the address space. With
the modified ld/scripttempl/elf.sc, the hole is now at the end of the
text segment.
Leaving a hole in the address space is clearly a bug. Your patch
should not be necessary. Why are these sections being created with a
non-zero size, and then being removed? That makes no sense.
Your patch is just papering over whatever the real problem is. There
is no reason to treat .rel.text differently from any other .rel
section.
However, there is another bug. Under certain conditions,
_bfd_elf_set_section_contents will be called on the ".rel.init"
sections with the section offset == 0, which corrupts the ELF header
among others. I have no idea why _bfd_elf_set_section_contents is
called with section offset == 0. I will be happy to provide a binary
testcase on Linux/x86.
This, too, is evidently a bug. Can you investigate why the sh_offset
field is 0? What is the size of the section? Who is calling
_bfd_elf_set_section_contents?
Ian