I've started reading Miro Samek's "Building Bare-Metal ARM Systems with GNU" and have found myself stuck on a certain point. What's caused my confusion is found in one of the notes found on page 10 of the PDF:
NOTE: The function low_level_init() can be coded in C/C++ with the following restrictions. The function must execute in the ARM state and it must not rely on the initialization of .data section or clearing of the .bss section. Also, if the memory remapping is performed at all, it must occur inside the low_level_init() function because the code is no longer position-independent after this function returns
How exactly is the code "no longer position-independent"? It seems as though the referenced code (viewable on pages 7 - 9 in the PDF) is still position-independent after returning from low_level_init
/ after the _cstartup
label. The only thing that seems different about the instructions after the _cstartup
label is that they reference labels that are defined in the linker script (Section 3 of the guide).
So how exactly does the remap affect whether or not the instructions following it are position-independent?