How to split memory in linker script to get the lower address as start of .text?

Ian Lance Taylor iant@google.com
Fri Apr 16 08:00:00 GMT 2010


"Jeffi Edward.J" <j.jeffi@yahoo.co.in> writes:

> I have a doubt in linker script MEMORY command.
>
> I have divided my available memory area into 3 regions as follows:
>
> MEMORY
> {
>    stack(w): org = 0x8000000, len = 0x50000
>    runtime(w) : org = 0x8050010, len = 0x400000
>    swimage(wx): org = 0x8450020, len = 0x30000
> }
>
> The swimage region contains text section as well as copy of .data,
> .bss(LMA).
> The runtime region contains .data, .bss sections (VMA).
>
> When I use objdump -p command to dump the program header for the .out
> generated with the above linker script MEMORY split, the lower address is
> interpreted as 0x8000000. The higher and execution addresses are dumped as
> expected. However, I would like to get the lower address of memory region as
> the start address of swimage region i.e 0x8450020.

I'm not sure what you mean.  If you mean that you want to adjust the
memory range based on the size of the your program, then the answer is
that you can not do that using the MEMORY command.  The MEMORY command
is intended for a system with different types of memory at different
addresses.  If all your memory is the same, use a linker script
without the MEMORY command.

Ian



More information about the Gcc-help mailing list