Don't set -pie for windows modules

Adding -pie to LOCAL_LDFLAGS for host linking leaves it around
when doing the host cross Windows linking, resulting in a warning:
clang-7: warning: argument unused during compilation: '-pie' [-Wunused-command-line-argument]

Add it later in binary.mk after the flags have been copied to the
single-use my_ldflags.

Bug: 115776263
Test: m checkbuild
Change-Id: I70d71fa1ec6445631dc7e89ef61927a3304375e2
This commit is contained in:
Colin Cross 2018-09-19 14:45:52 -07:00
parent e20c6588ce
commit feb4a7e4ae
3 changed files with 12 additions and 24 deletions

View File

@ -281,13 +281,18 @@ endif
# 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
else
my_cflags += -fPIC
endif
endif
ifneq ($($(my_prefix)OS),windows)
ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
my_cflags += -fPIE
ifndef BUILD_HOST_static
ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
my_ldflags += -pie
endif
endif
else
my_cflags += -fPIC
endif
endif
endif
ifdef LOCAL_IS_HOST_MODULE

View File

@ -1881,11 +1881,6 @@ endef
###########################################################
## Commands for running gcc to link a host executable
###########################################################
ifdef BUILD_HOST_static
HOST_FPIE_FLAGS :=
else
HOST_FPIE_FLAGS := -pie
endif
ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-executable-inner

View File

@ -11,10 +11,6 @@ my_module_multilib := first
endif
endif
ifeq ($(LOCAL_NO_FPIE),)
LOCAL_LDFLAGS += $(HOST_FPIE_FLAGS)
endif
ifeq ($(my_module_multilib),both)
ifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
@ -65,10 +61,6 @@ LOCAL_BUILT_MODULE :=
LOCAL_INSTALLED_MODULE :=
LOCAL_INTERMEDIATE_TARGETS :=
ifeq ($(LOCAL_NO_FPIE),)
LOCAL_LDFLAGS += $(HOST_CROSS_FPIE_FLAGS)
endif
include $(BUILD_SYSTEM)/host_executable_internal.mk
LOCAL_LDFLAGS := $(saved_LOCAL_LDFLAGS)
LOCAL_BUILT_MODULE := $(saved_LOCAL_BUILT_MODULE)
@ -88,10 +80,6 @@ LOCAL_BUILT_MODULE :=
LOCAL_INSTALLED_MODULE :=
LOCAL_INTERMEDIATE_TARGETS :=
ifeq ($(LOCAL_NO_FPIE),)
LOCAL_LDFLAGS += $(HOST_CROSS_FPIE_FLAGS)
endif
include $(BUILD_SYSTEM)/host_executable_internal.mk
LOCAL_LDFLAGS := $(saved_LOCAL_LDFLAGS)
LOCAL_BUILT_MODULE := $(saved_LOCAL_BUILT_MODULE)