
Wolfgang Denk wd@denx.de wrote on 2010/10/12 15:47:19:
Dear Joakim Tjernlund,
In message <OF4DCFBD28.58E81A84-ONC12577BA.0047150B-C12577BA. 0047D319@transmode.se> you wrote:
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.
OK, so your change means effectively a no-op (except for the moderate size increase in start.S) to most of us?
Yes.
You mentioned -fpic was smaller and faster; do you have any numbers for that (especailly for the faster part) ?
No, but I can show a code fragment,
char *f() { return "string"; }
-fPIC -mplt-bss: .LC1: .long .LC0 .section ".text" .align 2 .globl f .LCL0: .long .LCTOC1-.LCF0 .type f, @function f: stwu 1,-16(1) mflr 0 bcl 20,31,.LCF0 .LCF0: stw 30,8(1) mflr 30 stw 0,20(1) lwz 0,.LCL0-.LCF0(30) add 30,0,30 lwz 0,20(1) lwz 3,.LC1-.LCTOC1(30) mtlr 0 lwz 30,8(1) addi 1,1,16 blr .LC0: .string "string" .ident "GCC: (Gentoo 4.4.4-r2 p1.2, pie-0.4.5) 4.4.4" .section .note.GNU-stack,"",@progbits
-fpic -mbss-plt: f: stwu 1,-16(1) mflr 12 bl _GLOBAL_OFFSET_TABLE_@local-4 stw 30,8(1) mflr 30 mtlr 12 lwz 3,.LC0@got(30) lwz 30,8(1) addi 1,1,16 blr .LC0: .string "string" .ident "GCC: (Gentoo 4.4.4-r2 p1.2, pie-0.4.5) 4.4.4" .section .note.GNU-stack,"",@progbits
_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.
OK - can you please include these explanations into the commit message? Thanks.
Will do.
Jocke