This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: VMA section overlap warnings for overlays
- From: "David Stubbs" <stubbs at IceraSemi dot com>
- To: <binutils at sourceware dot org>
- Cc: "Alan Modra" <amodra at gmail dot com>, "sdkteam-gnu" <sdkteam-gnu at IceraSemi dot com>
- Date: Fri, 7 May 2010 17:14:06 +0100
- Subject: RE: VMA section overlap warnings for overlays
- References: <4D60B0700D1DB54A8C0C6E9BE69163700E67DFD1@EXCHANGEVS.IceraSemi.local> <20100421082441.GG3510@bubble.grove.modra.org> <4D60B0700D1DB54A8C0C6E9BE69163700E7815C7@EXCHANGEVS.IceraSemi.local> <20100422011106.GI3510@bubble.grove.modra.org> <20100422015303.GK3510@bubble.grove.modra.org> <4D60B0700D1DB54A8C0C6E9BE69163700E7F2F15@EXCHANGEVS.IceraSemi.local> <20100424021750.GQ3510@bubble.grove.modra.org>
Hi,
If we have a single segment containing a BSS section followed by
overlays then we still get the overlap warning.
Does the following patch look like the correct fix? I believe it fixes
my original test case, and I've also tested it on i686-pc-linux-gnu
without any problems.
Thanks,
Dave.
Bfd/ChangeLog:
2010-05-07 David Stubbs <stubbs@icerasemi.com>
* elf.c (assign_file_positions_for_load_sections): Calculate
adjust
based on file size instead of memory size. Increment p->p_memsz
by
vma based calculation instead of adjust.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.510
diff -u -p -r1.510 elf.c
--- bfd/elf.c 24 Apr 2010 01:05:24 -0000 1.510
+++ bfd/elf.c 7 May 2010 15:41:09 -0000
@@ -4453,17 +4453,17 @@ assign_file_positions_for_load_sections
&& ((this_hdr->sh_flags & SHF_TLS) == 0
|| p->p_type == PT_TLS))))
{
- bfd_vma adjust = sec->lma - (p->p_paddr + p->p_memsz);
+ bfd_vma adjust = sec->lma - (p->p_paddr + p->p_filesz);
- if (sec->lma < p->p_paddr + p->p_memsz)
+ if (sec->lma < p->p_paddr + p->p_filesz)
{
(*_bfd_error_handler)
(_("%B: section %A lma 0x%lx overlaps previous
sections"),
abfd, sec, (unsigned long) sec->lma);
adjust = 0;
- sec->lma = p->p_paddr + p->p_memsz;
+ sec->lma = p->p_paddr + p->p_filesz;
}
- p->p_memsz += adjust;
+ p->p_memsz += sec->vma - (p->p_vaddr + p->p_memsz);
if (this_hdr->sh_type != SHT_NOBITS)
{