[U-Boot] [PATCH] mpc83xx: Add -fpic relocation support

Joakim Tjernlund joakim.tjernlund at transmode.se
Tue Oct 12 20:11:08 CEST 2010


> 
> Le 12/10/2010 19:11, Joakim Tjernlund a écrit :
> 
> > Figured I should mention that I have added -msingle-pic-base(from ARM)
> > which
> > works nicely with -fpic(not sure if -fPIC is possible) and reduces 
size
> > even more:
> 
> Since you seem to be following the same path as I did on ARM, I may as 
> well ask: did you try removing -fPIC and -msingle-pic-base from compile 
> options and adding -pie to the link options instead?

looked at it briefly but -pie is really massive. Each access needs
a reloc entry, even if they access the same data.

> 
> Link option -pie generates ELF relocation and, on ARM at least, does a 
> better job than GOT reloc, which does not fix handle pointers in 
> initialized data while ELF reloc fixes them.

on ppc -mrelocatable does the job for you and adds fixup relocs.
It a simple addon that should be fairly easy to add to other archs too.

> 
> And since ELF reloc does not modify code (it is a linker option), you 

ehh, I think you need to reloc directly in the text segment.

> end up with the same size for text+data+rodata. You do have a bigger 
> FLASH image though, because the ELF reloc tables are bigger than the GOT 

> table; but you can git rid of them / not copy them to RAM once 
relocated.

I don't think RAM is as much as a problem as flash is.

> 
> The move from -fPIC to ELF on ARM can be looked for in the elf_reloc 
> branch of the u-boot-arm repo.

Yes, but I believe the ppc way is smaller once -fpic and -msingle-pic-base
are used(In flash anyway).
Also, I don't think you will be able to do true PIC in the
future without PIC code.

 Jocke


More information about the U-Boot mailing list