LMA XXX Overlaps Previous Sections When Using PHDRS
DeRosa, Anthony
Anthony.DeRosa@edocorp.com
Wed Dec 19 22:19:00 GMT 2007
Hello,
I want to install the contents of an ELF file on a flash device, using
the LMA of the sections (or rather p_paddr of program header) in the ELF
as the addresses in flash. The VMA and LMA will thus be different. I
am using "PHDRS" in my linker script in order to specify where the
various sections should be installed on flash. The problem I am seeing
is the following message:
$ i686-elf-gcc -o test.elf test.S -T link.ld -nostartfiles
/opt/cross-tools/binutils-2.17-gcc-4.1.1-newlib-1.14.0/lib/gcc/i686-elf/
4.1.1/../../../../i686-elf/bin/ld: test.elf: section .section_0 lma
0x1000 overlaps previous sections
/opt/cross-tools/binutils-2.17-gcc-4.1.1-newlib-1.14.0/lib/gcc/i686-elf/
4.1.1/../../../../i686-elf/bin/ld: test.elf: section .section_1 lma
0x1020 overlaps previous sections
Is this a warning, an error, or neither? Why does it say "lma 0x1000"?
I thought the VMA was 0x1000, and the LMA is 0x4000.
Here is the example code and a contrived linker script.
------------------------------------------------------------------------
----
-- code
------------------------------------------------------------------------
----
.global _start
.section .text_0, "ax"
_start:
jmp foo
.section .text_1, "ax"
foo:
jmp foo
------------------------------------------------------------------------
----
-- linker script
------------------------------------------------------------------------
----
ENTRY (_start)
MEMORY
{
ram_0 : ORIGIN = 0x00001000, LENGTH = 32
ram_1 : ORIGIN = 0x00001020, LENGTH = 32
}
PHDRS
{
phdr_0 PT_LOAD AT (0x4000);
phdr_1 PT_LOAD AT (0x5000);
}
SECTIONS
{
.section_0 :
{
*(.text)
*(.data)
*(.bss)
*(.text_0)
} >ram_0 : phdr_0
.section_1 :
{
*(.text_1)
} >ram_1 : phdr_1
}
More information about the Binutils
mailing list