[fpc-pascal] GCC -PIE equivalent?

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Nov 13 19:04:13 CET 2015

On 12/11/15 17:12, Jon Foster wrote:
> What we've discovered is that if we try to run the compiler on Android 5
> (Lollipop) or greater the binary won't load and complains that it isn't
> a "Position Independent Executable" (PIE). This is a feature similar to
> PIC. In GCC they have a separate flag -fPIE as opposed to the -fPIC. The
> purpose is to make the whole executable relocatable to facilitate
> "randomized address spaces".
> If I build a standard "program" (not library) with -Cg do I get a PIE...
> or does that only affect linking for libraries? I haven't been able to
> find anything on the iNet regarding PIE and FPC.

The problem is that the startup code for Android, which is handwritten 
assembly and hence not affected by any compiler switches, contains 
non-PIC code.

This has been fixed in trunk fairly recently, but it was too late for 3.0.


More information about the fpc-pascal mailing list