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

Peter Korsgaard peter at korsgaard.com
Tue May 12 12:20:03 UTC 2015


>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni at free-electrons.com> writes:

 > Dear Peter Korsgaard,
 > On Tue, 12 May 2015 00:19:14 +0200, Peter Korsgaard wrote:

 >> BINFMT_FLAT implies BR2_STATIC_LIBS and (elf) static libraries should
 >> also not be built with -fPIE / -pie, right?
 >> 
 >> Is there any specific reason to only do this workaround for BINFMT_FLAT?

 > Actually, I'm a bit confused. Shouldn't FLAT binaries be PIE ? Since
 > there's no MMU, each binary will be loaded at a different address, so
 > binaries should be PIE, no?

 > But the original reason why I removed -pie is because of:

 >   https://www.mail-archive.com/toolchain-devel@blackfin.uclinux.org/msg02113.html

 > For the exact same error, Mike Frysinger says to remove the -pie flag.

 > Hum, http://www.kdvelectronics.eu/uClinux-cisco2500/exotica.html seems
 > to indicate that PIE is not required in all cases for FLAT binaries.

 > I would tend to trust Mike Frysinger on this, though :)

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.

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?

-- 
Peter Korsgaard 



More information about the buildroot mailing list