This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Section (.sdata2) being omitted but SIZEOF(.sdata2) is not zero?
- From: Alan Modra <amodra at gmail dot com>
- To: Douglas Graham <douglas dot graham at ericsson dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 22 Jan 2014 08:33:39 +1030
- Subject: Re: Section (.sdata2) being omitted but SIZEOF(.sdata2) is not zero?
- Authentication-results: sourceware.org; auth=none
- References: <E36F5062C1BCFC48B8230995895548DF02C35784 at eusaamb109 dot ericsson dot se> <E36F5062C1BCFC48B8230995895548DF02C357A9 at eusaamb109 dot ericsson dot se> <20140119092749 dot GJ5390 at bubble dot grove dot modra dot org> <E36F5062C1BCFC48B8230995895548DF02C359DC at eusaamb109 dot ericsson dot se> <E36F5062C1BCFC48B8230995895548DF02C359F8 at eusaamb109 dot ericsson dot se> <20140120045856 dot GL5390 at bubble dot grove dot modra dot org> <E36F5062C1BCFC48B8230995895548DF02C36026 at eusaamb109 dot ericsson dot se> <20140121080319 dot GQ5390 at bubble dot grove dot modra dot org> <E36F5062C1BCFC48B8230995895548DF02C36460 at eusaamb109 dot ericsson dot se>
On Tue, Jan 21, 2014 at 03:16:20PM +0000, Douglas Graham wrote:
> >
> > Yes, I think you've nailed it (a nice debugging effort!). We strip sections early
> > based on their sizes before relaxation. Your .sdata2 section is empty except
> > for the padding, and the layout before relaxation just happens to need no
> > padding. After relaxation you need padding but the section with the padding
> > has gone. :-(
>
> Does this fully explain the case where both .sdata2 is missing *and* the following .data section is not aligned on a 4KB boundary? I can't find an elf file showing that at the moment, but I think I included objdump output somewhere in this thread showing it. IIRC, .data started 0x200 bytes beyond a page boundary. I think the phantom .sdata2 section was 0x400 bytes in that case.
Yes, it does explain that situation. The one it doesn't fully explain
is when .sdata2 has been removed and the following .data section needs
padding to be aligned to a 4k boundary, and .data *is* aligned to 4k.
I think it likely your .data section is aligned by virtue of
containing input sections that are aligned (probably to a 0x200
boundary from what you're saying), so that would explain 0x200
alignment. Sometimes that also happens to be 0x1000 alignment.
--
Alan Modra
Australia Development Lab, IBM