diff options
author | Nick Kralevich <nnk@google.com> | 2011-10-24 10:53:36 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2011-10-24 11:37:37 -0700 |
commit | 026a85b129e4540a4d8d40aace47aa0c69f609da (patch) | |
tree | ac21ef4847aab825d2163b5a85156fd95de8f43a /core | |
parent | 4fc484a7fe8ed6841848b8ce4a1142eee417b84d (diff) | |
download | build-026a85b129e4540a4d8d40aace47aa0c69f609da.zip build-026a85b129e4540a4d8d40aace47aa0c69f609da.tar.gz build-026a85b129e4540a4d8d40aace47aa0c69f609da.tar.bz2 |
enable PIE for dynamically linked executables
Compile all programs on Android with -fPIE and -pie. This enables
PIE (Position Independent Executables), which helps protect Android
applications from exploitation due to memory management bugs.
Stop using the armelf.x linker script. This script hard codes the
load address of the executable, defeating the position independence
PIE requires.
Note: PIE *static* executables are not supported at this time and
require additional linker changes.
Bug: 5323301
Change-Id: Ieafcc9c4f142495847e163881889d371a59d0878
Diffstat (limited to 'core')
-rw-r--r-- | core/combo/TARGET_linux-arm.mk | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk index 8c89143..09b2619 100644 --- a/core/combo/TARGET_linux-arm.mk +++ b/core/combo/TARGET_linux-arm.mk @@ -102,7 +102,7 @@ android_config_h := $(call select-android-config-h,linux-arm) arch_include_dir := $(dir $(android_config_h)) TARGET_GLOBAL_CFLAGS += \ - -msoft-float -fpic \ + -msoft-float -fpic -fPIE \ -ffunction-sections \ -fdata-sections \ -funwind-tables \ @@ -266,7 +266,7 @@ $(hide) $(PRIVATE_CXX) \ endef define transform-o-to-executable-inner -$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \ +$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \ -Wl,-dynamic-linker,/system/bin/linker \ -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ |