This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: some question about output section
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