This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

.data section relocation in gnu.targets.arm.rtsv7A startup



Can anyone explain me please the goal of the following code in startup.c:

    // relocate the .data section
    dl = & __data_load__;
    ds = & __data_start__;
    de = & __data_end__;
    while (ds < de) {
        *ds = *dl;
        dl++;
        ds++;
    }

Data section is defined as

    .data : {
        __data_load__ = LOADADDR (.data);
        __data_start__ = .;
        *(.got.plt)
        *(.got)
        *(.shdata)
        KEEP (*(.data))
        KEEP (*(.data*))
        *(.gnu.linkonce.d.*)
        . = ALIGN (4);
        __data_end__ = .;
    } > REGION_DATA AT>REGION_DATA

Why does it need relocation?