ld maps sections without consider memory region?
Masaki Muranaka
monaka@monami-software.com
Wed Feb 14 09:18:00 GMT 2007
Hello,
I'm using for embedded application and I'm confusing ld's output.
Follows are extremely simplified example:
My target have two ROMs and their address regions aren't continuous.
So I put MEMORY command into ldscript.
- - - - -
MEMORY {
REGION_ROM1 : ORIGIN = 0x0000, LENGTH = 0x080
REGION_ROM2 : ORIGIN = 0x0100, LENGTH = 0x800
REGION_OTHER : ORIGIN = 0x2000, LENGTH = 0x080
}
SECTIONS {
.begin : {
begin.o(.text);
} > REGION_ROM1
.tail : {
tail.o(.text);
} > REGION_ROM2
/* dummy */
.data : { } > REGION_OTHER
.bss : { } > REGION_OTHER
}
- - - - -
And I called ld.
But ld combined .begin and .tail section to same program header
like this:
- - - - - -
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg
Align
LOAD 0x000054 0x00000000 0x00000000 0x00204 0x00204 R E 0x4
Section to Segment mapping:
Segment Sections...
00 .begin .tail
- - - - - -
Address 0x81 to 0x0ff are zero filled. This causes bus error
as there is no memory. Of course it is unexpected to me.
Why is ld merge these sections without considering MEMORY command?
My target environment is mips64-elf (GNU ld version 2.17.50 20060513).
Any comments appreciate.
--
Masaki Muranaka
Monami software
More information about the Binutils
mailing list