This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
"AT > region" interpreted as "> region" in linker script
- From: "Galit Heller" <Galit dot Heller at nsc dot com>
- To: binutils at sources dot redhat dot com
- Date: Wed, 31 Dec 2003 12:18:59 +0200
- Subject: "AT > region" interpreted as "> region" in linker script
Hi,
The following is an undocumented (and perhaps unintended) behavior of ld
linker scripts:
When using the "AT > load_region" expression in an output section statement, if
the statement does not include a "> virtual_region" expression as well, then
the "AT >" expression is interpreted as an ">" expression, i.e. load_region
is used as the virtual region.
Examples:
Suppose the memory is allocated as follows:
MEMORY {
ram : ORIGIN = 0x10, LENGTH = 0x100
rom : ORIGIN = 0xF00, LENGTH = 0x100
}
This sets the virtual address to 0x10 and the load address to 0xF00, as
expected:
SECTIONS { .data : {*(.data) } > ram AT > rom }
However, this statement results in the error (for .data size of 8 bytes):
"ld: address 0x18 of a.out section .data is not within region rom".
SECTIONS { .data 0x10 : {*(.data) } AT > rom }
And the following simply sets the virtual address to 0xf00, w/o any
load address:
SECTIONS { . = 0x10; .data : { *(.data) } AT > rom }
Is this a documentation issue or a bug ?
Thanks,
Galit.