Alan Modra <amo...@gmail.com> wrote on 2010/10/11 14:58:45: > > On Sun, Oct 10, 2010 at 11:20:06AM +0200, Joakim Tjernlund wrote: > > Now I have had a closer look at this and it looks much like -fpic > > on ppc32, you still use the GOT/TOC to load the address where the data is. > > No, with ppc64 -mcmodel=medium you use the GOT/TOC pointer plus an > offset to address local data. > > > I was looking for true %pc relative addressing of data. I guess this is > > really > > hard on PowerPC? > > Yes, PowerPC lacks pc-relative instructions. > > > I am not sure this is all it takes to make -fpic to work with -mrelocatable, > > any ideas? > > You might be lucky. With -mrelocatable, .got2 only contains > addresses. No other constants. So a simple run-time loader can > relocate the entire .got2 section, plus those locations specified in > .fixup. You'll have to make sure gcc does the same for .got, and your > run-time loader will need to be modified to handle .got (watch out for > the .got header!).
Got it working now. It was just u-boot reloc routine I first failed to extend properly to reloc *got too. I think this is safe as one can mix fpic with fPIC and mrelocatable is the same as fPIC+fixups. Will you accept this patch into gcc? Jocke