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!). -- Alan Modra Australia Development Lab, IBM