public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "David Stubbs" <stubbs@IceraSemi.com>
To: "Alan Modra" <amodra@gmail.com>
Cc: <binutils@sourceware.org>,	"sdkteam-gnu" <sdkteam-gnu@IceraSemi.com>
Subject: RE: VMA section overlap warnings for overlays
Date: Wed, 12 May 2010 13:19:00 -0000	[thread overview]
Message-ID: <4D60B0700D1DB54A8C0C6E9BE69163700ED69E1A@EXCHANGEVS.IceraSemi.local> (raw)
In-Reply-To: <20100508114913.GA31122@bubble.grove.modra.org>

> On Fri, May 07, 2010 at 05:14:06PM +0100, David Stubbs wrote:
> > Does the following patch look like the correct fix?
> 
> No, it doesn't look correct.  I think your problem is more likely
> due
> to a ldlang.c bug in setting lma.  Do you have a testcase handy?

Thanks for the response. I didn't realize / think that you needed to
allocate filespace for bss sections when they're followed by non BSS
sections in the same segment. 

I wasn't able to reproduce the problem, but that turned out to be
because I'd somehow lost the bit of code that calls write_zeros in our
copy of the source.

I have however found another potential problem with strip. Here's the
test:

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

        .section SEC_NAME.bss,"aw",@nobits
        .zero 0x10
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

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

  .overlay1 ADDR (.dmem.bss) + SIZEOF (.dmem.bss)
    : AT (LOADADDR (.dmem.bss) + SIZEOF (.dmem.bss))
  {
    *(.overlay1)
  } :imem
      
  .overlay2 ADDR (.dmem.bss) + SIZEOF (.dmem.bss)
    : AT (LOADADDR (.overlay1) + SIZEOF (.overlay1))
  {
    *(.overlay2)
  } :imem

  .overlay1.bss ADDR (.overlay1) + SIZEOF (.overlay1)
    : AT (LOADADDR (.overlay2) + SIZEOF (.overlay2))
  {
    *(.overlay1.bss)
  } :imem

  .overlay2.bss ADDR (.overlay2) + SIZEOF (.overlay2)
    : AT (LOADADDR (.overlay1.bss) + SIZEOF (.overlay1.bss))
  {
    *(.overlay1.bss)
  } :imem

}
brsbs01 0>gcc over.S -DSEC_NAME=.overlay1 -c -o over1.o
brsbs01 0>gcc over.S -DSEC_NAME=.overlay2 -c -o over2.o
brsbs01 0>gcc start.s -c -o start.o
brsbs01 0>ld over1.o over2.o start.o -T ldscript.x -o test.exe 
brsbs01 1>strip test.exe
BFD: stHVOxcK: section .overlay1.bss lma 0x1021 overlaps previous
sections
BFD: stHVOxcK: section .overlay2.bss lma 0x1021 overlaps previous
sections
---

The overlap warning is being emitted because 'adjust' is being
calculated as a negative number. I don't yet know why.

Thanks again,
Dave.

  reply	other threads:[~2010-05-12 13:19 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-16 13:29 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D60B0700D1DB54A8C0C6E9BE69163700ED69E1A@EXCHANGEVS.IceraSemi.local \
    --to=stubbs@icerasemi.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=sdkteam-gnu@IceraSemi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).