
Albert ARIBAUD albert.aribaud@free.fr wrote on 2010/10/13 08:30:33:
Le 12/10/2010 23:00, Joakim Tjernlund a écrit :
Yes, but the difference isn't really the arch. It is the -mrelocatable flag that is the big difference.
Not only: obviously, implementing GOT relocation is not done the same on
both archs, and it simply is not beneficial on ARM wrt PPC in terms of instructions. I did a pretty extensive run of tests with and without -fPIC and -fPIE on ARM, and GOT relocation clearly makes code bigger, whereas it does not PPC.
Did you use -msingle-pic-base too with -fpic/-fPIC? This is what makes a difference(together with -fpic). The most interesting size is the total flash size IMHO. Reducing insn's in RAM at the expense of flash is not what most users need I think.
This simply implies that -fPIC is a better choice for PPC (and hence -mrelocatable) while -fpie is a better one for ARM.
-fPIC isn't optimal(it is bigger) but until my gcc patch gets into gcc one cannot use -fpic(it gets promoted to -fPIC by gcc). -fpic is smaller but one cannot build apps has has a GOT over 32KB with that