
After code is relocated, cpu jumped from flash to RAM, I have two questions I can't understand. Any help will be appreciated greatly.
1. Because TEXT_BASE=0xfff80000 which points to flash space, after code is copied from flash to RAM and start to run from RAM, how can u-boot make sure code is place independent? For example, what if I write such code as follows: <code> lis r0, LABEL@h ori r0, r0, LABEL@l mtlr r0 blr </code> Here, symbol "LABEL" must be a value which also points to flash space. After "blr" is executed, we go back to flash, right?
2. Similar as question 1, if I define a global variable like this in a C file: static int my_global = 1; powerpc-linux-readelf command shows that my_global located in .data section and its symbol value also points to flash space. When running in RAM, if I want to change its value: my_global = 2; I don't know how compilor translate this C code into assembly, if it uses absolute address to locate my_global, I think writing can't be operated, so does compilor use relative address to locate my_global? But how?