Effect of the AT instruction

V S vsiles83@gmail.com
Wed Dec 20 08:02:00 GMT 2017


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



More information about the Binutils mailing list