public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* VMA section overlap warnings for overlays
@ 2010-04-16 13:29 David Stubbs
  2010-04-21  8:25 ` Alan Modra
  0 siblings, 1 reply; 40+ messages in thread
From: David Stubbs @ 2010-04-16 13:29 UTC (permalink / raw)
  To: binutils

Hi,

I have an issue with overlays that seems to have come about as a result
of this patch (http://sourceware.org/ml/binutils/2008-05/msg00235.html):

---
2008-05-28  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* elf.c (assign_file_positions_for_load_sections): Adjust
pre-section
	gaps based on VMA and P_VADDR instead of LMA and P_PADDR
addresses.
---

Consider the following simplified code:

---
brsbs01 0>cat over.S
        .section SEC_NAME,"ax",@progbits
        nop
        
brsbs01 0>cat start.s
        .section        .text,"ax",@progbits
        .globl  _start
        .type   _start, @function
_start:
        nop

        .section        .imem,"ax",@progbits
        nop

brsbs01 0>cat ldscript.x 
OUTPUT_FORMAT("elf32-i386")
OUTPUT_ARCH(i386)

ENTRY(_start)

PHDRS
{
  mem PT_LOAD;
  imem PT_LOAD;
}

SECTIONS
{
  .text 0x1000:
  {
    *(.text)
  } :mem

  .imem 0x2000 : AT (LOADADDR (.text) + SIZEOF (.text))
  {
    *(.imem)
  } :imem

  .overlay1 ADDR (.imem) + SIZEOF (.imem) 
    : AT (LOADADDR (.imem) + SIZEOF (.imem))
  {
    *(.overlay.1)
  } :imem
       
  .overlay2 ADDR (.imem) + SIZEOF (.imem) 
    : AT (LOADADDR (.overlay1) + SIZEOF (.overlay1))
  {
    *(.overlay.2)
  } :imem

  .overlay3 ADDR (.imem) + SIZEOF (.imem) 
    : AT (LOADADDR (.overlay2) + SIZEOF (.overlay2))
  {
    *(.overlay.3)
  } :imem
}
---

Built with:

---
gcc over.S -DSEC_NAME=".overlay.1" -c -o over1.o
gcc over.S -DSEC_NAME=".overlay.2" -c -o over2.o
gcc over.S -DSEC_NAME=".overlay.3" -c -o over3.o
gcc start.s -c -o start.o
ld over1.o over2.o over3.o start.o -T ldscript.x -o test.exe 
---

Using an old version of GNU ld (2.17) I don't get any linker warnings,
and the executable looks as I'd expect.

When using the latest code from CVS, I get the following warnings when
linking:

---
brsbs01 0>ld-new over1.o over2.o over3.o start.o -T ldscript.x -o
test.exe
ld-new: test.exe: section .overlay2 vma 0x2001 overlaps previous
sections
ld-new: test.exe: section .overlay3 vma 0x2001 overlaps previous
sections
---

As it happens, the executable actually looks correct in this case, but
the warnings can't be a good thing. Also, I have a larger case where
we're getting these warnings and our overlays aren't working (whereas
they used to with an older linker) - I just haven't managed to reproduce
this problem in a smaller test yet...

Am I doing something wrong or unusual in my linker script, or does it
look like there's a problem in the linker?

Thanks for any advice,
Dave.

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2011-02-25 16:34 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-16 13:29 VMA section overlap warnings for overlays David Stubbs
2010-04-21  8:25 ` Alan Modra
2010-04-21 14:44   ` David Stubbs
2010-04-22  1:11     ` Alan Modra
2010-04-22  1:53       ` Alan Modra
2010-04-22 12:39         ` David Stubbs
2010-04-24  2:18           ` Alan Modra
2010-05-07 16:14             ` David Stubbs
2010-05-08 11:49               ` Alan Modra
2010-05-12 13:19                 ` David Stubbs
2010-05-13  3:37                   ` Alan Modra
2010-07-15  8:11             ` Andreas Schwab
2010-07-15 13:10               ` Alan Modra
2010-07-15 13:46                 ` Andreas Schwab
2010-07-15 13:53                   ` H.J. Lu
2010-07-15 14:12                     ` Andreas Schwab
2010-07-15 14:17                       ` H.J. Lu
2010-07-15 14:18                     ` Alan Modra
2010-07-15 14:26                       ` H.J. Lu
2010-07-15 14:36                         ` Andreas Schwab
2010-07-15 19:09                           ` H.J. Lu
2010-07-16  7:39                             ` Andreas Schwab
2010-07-16 10:04                               ` Alan Modra
2010-07-19 12:43                                 ` Andreas Schwab
2010-07-20  5:45                                   ` Alan Modra
2010-07-20 14:11                                     ` Alan Modra
2011-02-24 23:49                                       ` H.J. Lu
2011-02-25  7:49                                         ` Alan Modra
2011-02-25 10:17                                           ` Andreas Schwab
2011-02-25 12:30                                           ` H.J. Lu
2011-02-25 15:55                                           ` H.J. Lu
2011-02-25 16:23                                             ` Andreas Schwab
2011-02-25 16:34                                               ` H.J. Lu
2010-08-28  1:02         ` H.J. Lu
2010-08-28 11:00           ` Alan Modra
2010-08-28 13:39             ` Alan Modra
2010-08-28 17:25               ` H.J. Lu
2010-08-30  4:46                 ` Alan Modra
2010-08-30  5:11                   ` H.J. Lu
2010-08-30  6:30                     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).