Can the GCC toolchain be built AS a PIE?

Alexander Monakov amonakov@ispras.ru
Mon Jun 15 16:21:00 GMT 2015


On Thu, 11 Jun 2015, Cyd Haselton wrote:

> Advance apologies if this question has been asked previously, Google
> searches only turned up results for using -fPIE/-fPIC.
> 
> Is it possible to build GCC as a PIE? If so, would it be a matter of
> including the -FPIC/-FPIE params for CFLAGS and/or LDFLAGS and running
> configure && make, or are there issues I should be aware of (for example,
> should I set parameters for cross-building)?
> 
> Background: Android 5.0 requires PIE, which means that upgrading will break
> my existing native build environment...unless I can build a PIE GCC first,
> then re-build all of my utilities with it.

I don't have a ready answer for you, but if I was in a similar situation I'd
look how security-oriented distributions that prefer PIE (to give specific
examples: Gentoo Hardened profile, Alpine Linux) build their GCC.

Hope that helps.
Alexander



More information about the Gcc-help mailing list