Carl-Daniel Hailfinger wrote:
Absolute calls from initram were only working from the file which had _MAINOBJECT #defined. Calls from all other files ended up in nirvana because the compiler was not able to calculate the address of the wrapper for the absolute call. The linker tried, but failed miserably. Use the -combine flag and compile all of initram at once. This enables GCC to calculate the address of the abscall wrapper, resulting in working code.
Segher Boessenkool thinks the patched code works only by accident because GCC has no way to specify generation of XIP code. According to him, future GCC versions or other circumstances may break the code.
While this patch makes code work for now, it does NOT check whether the generated code tries to write to memory outside the stack (general writable data). That will of course fail, but I hope porters are smart enough to avoid that.
Great work tracking this down! This is okay for now, but we need to look for a better solution in the future. Counting on porters who may or may not remember this discussion to avoid something isn't good future-proofing.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
I've attached a QEMU bootlog, it seems to make the calls to the right places, but still won't boot FILO. Per IRC, I won't ack at the moment until more people can test, but it does look good to me :)
-Corey