
Wolfgang Denk wd@denx.de wrote on 2010/10/12 14:52:18:
Dear Joakim Tjernlund,
In message
1286887081-23172-1-git-send-email-Joakim.Tjernlund@transmode.se you wrote:
This add relocation of .got entries produced by -fpic. -fpic produces 2-3% smaller code and is faster. Unfortunately gcc promotes -fpic to -fPIC when -mrelocatable is used so one need a very small patch to gcc too(sent upstream).
What happens when one uses this patch in combination with a "standard" (i. e. older, unpatched) GCC?
Nothing, gcc will produce -fPIC relocs and the code will/should just work.
START_GOT GOT_ENTRY(_GOT2_TABLE_)
- GOT_ENTRY(_GOT_TABLE_)
- GOT_ENTRY(_GLOBAL_OFFSET_TABLE_) GOT_ENTRY(__bss_start) GOT_ENTRY(_end)
@@ -951,6 +953,22 @@ in_ram: stw r0,0(r3) 2: bdnz 1b
- lwz r4,GOT(_GLOBAL_OFFSET_TABLE_)
What exactly is _GLOBAL_OFFSET_TABLE_ good for, and how does it differ from _GOT_TABLE_ ?
_GLOBAL_OFFSET_TABLE_ is a predefined symbol that the linker defines to be in the middle of the -fpic GOT table. It marks the end of the GOT table as far as we are concerned(u-boot does not generate so many relocs that the linker needs to use the space above _GLOBAL_OFFSET_TABLE_)
There is no predefined symbol that marks the start of fpic relocs so one is added(_GOT_TABLE_) by me to the linker script.
Jocke