This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

"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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]