This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Effect of the AT instruction
- From: V S <vsiles83 at gmail dot com>
- To: binutils at sourceware dot org
- Date: Wed, 20 Dec 2017 09:01:21 +0100
- Subject: Effect of the AT instruction
- Authentication-results: sourceware.org; auth=none
Hi !
I'm trying to understand clearly the behavior of the AT instruction (see
[1]).
>From my understanding, if I don't specify any AT or AT> to a region, its
LMA will be equal to its VMA.
However in practice, it seems that once I used AT once, the next LMA will
be also affected by it, even
if I don't recall it. Check [2] for a full example, I'll try to give a
shorter one here:
_text_start = .;
.text : AT(ADDR(.text) - some_offset)
{
*(.text .text.*)
}
_text_end = .;
. = ALIGN(0x1000);
_rodata_start = .;
.rodata : AT(ADDR(.rodata) - some_offset)
{
*(.rodata*)
}
_rodata_end = .;
If I remove the AT instruction of the .rodata section, I still get the same
LMA for .rodata
My understanding is that every action that affects `.` also affects the
underlying LMA, so in this particular
case, only the first AT instance is necessary.
Could anyone confirm that, or point me to the right documentation to
understand what's really happening ?
Best regards,
V.
[1] https://sourceware.org/binutils/docs/ld/Output-Section-LMA.html
[2]
https://stackoverflow.com/questions/47866409/ld-and-noload-sections-understanding-strange-lma-value