I have a simple asm file with 3 sections:
.code 32
.section sec1
MOV R3, #10
.section sec2
MOV R1, #10
.section sec3
MOV R2, #10
.end
And a linker script:
MEMORY
{
ram : ORIGIN = 0x00200000, LENGTH = 1K
rom : ORIGIN = 0x00100000, LENGTH = 1K
}
SECTIONS
{
.text :
{
*(.glue_7t)
*(.glue_7)
*(.text)
}>rom
.sec1 :
{
*(sec1)
}>rom
.sec2 :
{
_ram_start = .;
*(sec2)
}>ram AT> rom
.sec3 :
{
*(sec3)
}>ram AT> rom
.data :
{
*(.data)
}>ram
.bss :
{
*(.bss)
}>ram
}
I assume that .sec2 should have VMA address set to ram's origin, but the LMA should be the address after .sec1, but objdump gives me:
test2.o: file format elf32-littlearm
Sections:
Idx Name Size VMA LMA File off Algn
0 .sec1 00000004 00100000 00100000 00000034 2**0
CONTENTS, READONLY
1 .sec2 00000004 00200000 00200000 00000038 2**0
CONTENTS, READONLY
2 .sec3 00000004 00200004 00200004 0000003c 2**0
CONTENTS, READONLY
Why is the .sec2 LMA set to ram?