From: loody <miloody@gmail.com>
To: amodra@gmail.com, binutils@sourceware.org
Subject: Re: some question about output section
Date: Thu, 19 May 2011 04:31:00 -0000 [thread overview]
Message-ID: <BANLkTikKjehG11j4Vt__VdnHAWG1CpUb6A@mail.gmail.com> (raw)
In-Reply-To: <BANLkTingH0X=9R1zmz2U5WvRrZmOMBn5mw@mail.gmail.com>
hi:
2011/5/18 loody <miloody@gmail.com>:
> hi
> 2011/5/11 Alan Modra <amodra@gmail.com>:
>> On Wed, May 11, 2011 at 02:27:09PM +0800, loody wrote:
>>> 2. I found if the LMA of 2 sections are quite close, the size of
>>> objcopy will get small, script1.
>>> But why if the LMA of third section is close to previous section, the
>>> size will still get big, script2?
>>
>> Why do you think the LMAs are close?
>>
>> Your scripts are setting LMA of a section to the end VMA of the
>> previous section. I suspect that wasn't what you intended.
>> See ld.info LOADADDR and SIZEOF.
>>
>
> I finally figured out what you mean :)
>
> I use MEMORY command in my ld script, and I found the LMA of one
> section will right behind previous one, even I didn't tell the script
> to do so.
>
> below is some part of my ld script:
> MEMORY
> {
> region0 : org = 0xbfc00000, l = 24k
> region1 : org = 0xbfc06000, l = 26k
> region2 : org = 0xbfb04000, l = 14k
> region3 : org = 0x80000000, l = 64k
> }
> ....
> .onlyText : { lib1.a:*.o (*.text) _eonlytext =
> ABSOLUTE(.); } >region2 AT>region0
>
> . = ALIGN(4);
> _fbss = .;
> .sbss : { *(.sbss) *(.scommon) *(.bss) *(COMMON) } >region2
>
> ...
>
>
> Below is the output of map:
> .sbss 0x00000000bfb05540 0x60 load address 0x00000000bfc0187c
> *(.sbss)
> *(.scommon)
> .scommon 0x00000000bfb05540 0x4 main.o
>
>
> It seem ".sbss" adopt the same setting of .onlyText even I didn't at
> AT>region0 at the end.
>
> appreciate your help,
> miloody
I do the following experimemts:
1. assign address directly instead of using MEMORY comamnd
".sbss" still adopt the same setting of .onlyText
.onlyText 0x00000000bfb04000 0x70 load address 0x00000000bfc0030c
Zebra*(.text)
.text 0x00000000bfb04000 0x70 Zebra.o
0x00000000bfb04000 testmain1
0x00000000bfb04070 _eonlytext = ABSOLUTE (.)
0x00000000bfb04070 . = ALIGN (0x4)
0x00000000bfb04070 _fbss = .
.sbss 0x00000000bfb04070 0x4 load address 0x00000000bfc0037c
*(.sbss)
*(.scommon)
2. I purposely let the content of .onlyText be empty and ".sbss" will
have the LMA that I expected.
------------------------------------------------------------------------------
.onlyText 0xbfb04000:AT(_etext) { /* Zebra*(.text)*/
_eonlytext =
ABSOLUTE(.); }
. = ALIGN(4);
_fbss = .;
.sbss : { *(.sbss) *(.scommon) *(.bss) *(COMMON) }
-------------------------------------------------------------------------------
.onlyText 0x00000000bfb04000 0x0 load address 0x00000000bfc00380
0x00000000bfb04000 _eonlytext = ABSOLUTE (.)
0x00000000bfb04000 . = ALIGN (0x4)
0x00000000bfb04000 _fbss = .
.sbss 0x00000000bfb04000 0x4
*(.sbss)
*(.scommon)
.scommon 0x00000000bfb04000 0x4 main.o
Why the attributes of .sbss is depended on the size of previous section?
If I didn't assign the LMA address of .sbss, it should be reset
instead of using the end of previous one, right?
Thanks a lot,
prev parent reply other threads:[~2011-05-19 4:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-27 15:29 loody
2011-04-28 0:57 ` Alan Modra
2011-04-28 16:17 ` loody
2011-04-29 0:32 ` Alan Modra
2011-05-01 13:21 ` loody
2011-05-04 15:51 ` loody
2011-05-05 0:35 ` Alan Modra
2011-05-05 3:00 ` loody
2011-05-05 3:57 ` Alan Modra
2011-05-11 6:27 ` loody
2011-05-11 7:18 ` Alan Modra
2011-05-11 8:12 ` loody
2011-05-18 5:32 ` loody
2011-05-19 4:31 ` loody [this message]
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=BANLkTikKjehG11j4Vt__VdnHAWG1CpUb6A@mail.gmail.com \
--to=miloody@gmail.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
/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).