Task #3671

ship -fPIE executables to support Android5/L

Added by hans over 3 years ago.

Status:NewStart date:08/23/2014
Priority:NormalDue date:
Assignee:vitriolix% Done:


Target version:-


Apparently, the upcoming Android5/L is going to require that -fPIE is set on all native builds of executables, or they won't be able to run. The pisser is that executables compiled with -fPIE will not run on platforms older than Android 4.1 (android-16). From android-ndk-r9d/docs/APPLICATION-MK.html:


Starting from Jelly Bean (4.1), Android's dynamic linker supports position-independent executables (PIE), which are built with -fPIE. This flag makes it harder to exploit memory corruption bugs by randomization the location of the code. By default, ndk-build will automatically set this value to 'true' if your project targets android-16 or higher. You may set it manually to either 'true' or 'false'.

IMPORTANT: PIE executables cannot run on Android releases prior to 4.1.

Note that this only applies to executables. It has no effect when building shared or static libraries.

More info:

Related issues

Related to Orbot - Task #3670: ship -fPIE executables to support Android5/L New 08/22/2014

Also available in: Atom PDF