This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] bfd/elf.c: fix section overlap warning again
On Fri, Jul 16, 2010 at 03:16:39PM -0400, DJ Delorie wrote:
> I suspect that adjusting LMAs of sections specified with an AT is not
> a good idea - in this case, it moves the reset vectors to RAM.
Right, and to fix that we'd need to generate two program headers for
your testcase. ELF can't give you overlapping LMAs any other way.
Like this:
* elf.c (_bfd_elf_map_sections_to_segments): Force new segment
for sections with overlapping LMAs.
We still need the other code to adjust LMAs when people provide
comflicting AT and PHDRS in linker scripts.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.511
diff -u -p -r1.511 elf.c
--- bfd/elf.c 18 May 2010 03:31:05 -0000 1.511
+++ bfd/elf.c 17 Jul 2010 01:12:51 -0000
@@ -3736,6 +3733,13 @@ _bfd_elf_map_sections_to_segments (bfd *
segment. */
new_segment = TRUE;
}
+ else if (hdr->lma < last_hdr->lma + last_size
+ || last_hdr->lma + last_size < last_hdr->lma)
+ {
+ /* If this section has a load address that makes it overlap
+ the previous section, then we need a new segment. */
+ new_segment = TRUE;
+ }
/* In the next test we have to be careful when last_hdr->lma is close
to the end of the address space. If the aligned address wraps
around to the start of the address space, then there are no more
> Any reason why we don't include "error:" in those messages by default?
Not that I know of.
--
Alan Modra
Australia Development Lab, IBM