Make PIC/PIE levels compatible for LTO.

The build system currently uses -fPIC for position independent
libraries, and -fpie for position independent executables. However,
these levels are incompatible and conflict when an executable includes
a static lib with the -fPIC flag - such as when building with
LTO. This CL changes the flag for executables to the compatible -fPIE
instead, which is equivalent for all architectures except PowerPC.

Bug: 30227045
Test: ENABLE_CFI=true m -j40 checkbuild # builds and boots
Change-Id: Ieb20bc2528300d88ff05e8787c5840ab6f03fb38
This commit is contained in:
Vishwath Mohan 2017-04-17 13:19:35 -07:00
parent 04e4fd3071
commit c3b255622d
1 changed files with 1 additions and 1 deletions

View File

@ -309,7 +309,7 @@ endif
ifneq ($(LOCAL_NO_PIC),true)
ifneq ($($(my_prefix)OS),windows)
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
my_cflags += -fpie
my_cflags += -fPIE
else
my_cflags += -fPIC
endif