[Buildroot] [PATCH] libmemcached: don't use -fPIE and -pie with FLAT binaries

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Tue May 12 12:22:46 UTC 2015


Dear Peter Korsgaard,

On Tue, 12 May 2015 14:20:03 +0200, Peter Korsgaard wrote:

> That's also the understanding I get from reading:
> 
> http://retired.beyondlogic.org/uClinux/bflt.htm
> 
> The flat format has its own relocation table that gets applied when
> loading.

Ok.

> I'm not quite sure how this would work with XIP though. The bottom of
> that page mentions that the binary then has to be built in PIC mode.
> 
> But my question was actually why we shouldn't disable PIE/PIC for static
> builds in general, and not just for flat mode?

Yes, -fPIC is not needed for static, but it works (it generates
slightly less efficient code though). But I'm fine with turning this
BR2_BINFMT_FLAT condition to a BR2_STATIC_LIBS condition.

But in practice, they are lots of packages that build code only once to
generate both a shared library and a static library, and they use -fPIC
for both. Guaranteeing that all static libraries have non-PIC code
would be a major effort.

Should I resend an updated patch, or will you commit after doing the
change?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the buildroot mailing list