From cbb038c8e8ea35ce1fafbdfd641405559dcd765b Mon Sep 17 00:00:00 2001 From: Alexey Polyudov Date: Mon, 1 Aug 2016 17:36:39 -0700 Subject: [PATCH] Add LOCAL_NO_PIC to disable position-independent code on some toolchains and architectures building non-PIC code renders more efficient assembly Bug: 29635686 Change-Id: I6274f40d24e1bb43f03b45c60b5487abed02b7fc Signed-off-by: Alexey Polyudov --- core/binary.mk | 2 ++ core/clear_vars.mk | 1 + 2 files changed, 3 insertions(+) diff --git a/core/binary.mk b/core/binary.mk index 4554d4db0..77362e31e 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -220,6 +220,7 @@ endif # MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because # all code is position independent, and then those warnings get promoted to # errors. +ifneq ($(LOCAL_NO_PIC),true) ifneq ($($(my_prefix)OS),windows) ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),) my_cflags += -fpie @@ -227,6 +228,7 @@ else my_cflags += -fPIC endif endif +endif ifdef LOCAL_IS_HOST_MODULE my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)OS)) $(LOCAL_SRC_FILES_$($(my_prefix)OS)_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 6121c45d2..6f5633cc2 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -143,6 +143,7 @@ LOCAL_PROTOC_FLAGS:= LOCAL_PROTO_JAVA_OUTPUT_PARAMS:= LOCAL_NO_CRT:= LOCAL_NO_LIBGCC:= +LOCAL_NO_PIC:= LOCAL_PROPRIETARY_MODULE:= LOCAL_OEM_MODULE:= LOCAL_ODM_MODULE:=