Task #3671
ship -fPIE executables to support Android5/L
Status: | New | Start date: | 08/23/2014 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | vitriolix | % Done: | 0% | |
Category: | - | |||
Target version: | - | |||
Component: |
Description
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:
More info:
APP_PIE
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.
Related issues