"AT > region" interpreted as "

"AT > region" interpreted as "> region" in linker script

Galit Heller Galit.Heller@nsc.com
Wed Dec 31 12:53:00 GMT 2003
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.



More information about the Binutils mailing list