Hi,
On Wed, Sep 22, 2010 at 2:04 PM, Loïc Minier loic.minier@linaro.org wrote:
On Wed, Sep 22, 2010, Dave Martin wrote:
I'm not a toolchain expert, so I'm happy to be overridden... but my _guess_ is:
I think that in practice (at least on arm) cc -fPIC = cc -fPIE, and ld -pie just forces ld to generate PIC veneers (as for -shared). Beyond this, I think ld -shared / -pie / (nothing) probably just changes which linker script is used by default. U-Boot overrides the default with its own linker script anyway, so it may make no difference.
Catching up on email, I just came across: http://article.gmane.org/gmane.comp.boot-loaders.u-boot/84789 so it seems to be different, but not significantly
Hmmm, interesting discussion: looks like my guess was naive ;)
It looks like -fPIE provides some savings after all, since it enables the compiler to make some additional assumptions.
I don't care too strongly, but it might make sense to try to use the flag which means exactly what we want to allow for future optimizations?
Since U-Boot is now trying to build PIC anyway, I suggest that for things to work robustly one of the following is needed anyway:
* -fPIE + -pie * -fPIC + -shared (less optimal?)
Logically, pie seems to be the closest match to what is actually happening in U-Boot.
Then we can optionally add:
* --use-blx (to get rid of ARM<->Thumb interworking veneers)
--pic-veneers could be used as a temporary fix, but this feels fragile to me: it only controls a speicific aspect of linker behaviour, so we could hit other problems in the future. We could do this as a short-term workaround to allow the linaro toolchain to be used in the meantime, though.
Cheers ---Dave