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?