am c37d7043: am 3ad14218: Merge "Strip prebuilt shared library by default."

* commit 'c37d7043e6fde29bf14218c31132dc48a9f7e995':
  Strip prebuilt shared library by default.
This commit is contained in:
Dan Albert 2015-03-13 23:29:06 +00:00 committed by Android Git Automerger
commit 78c6a1cb1a
4 changed files with 23 additions and 14 deletions

View File

@ -1435,7 +1435,8 @@ endif
define transform-to-stripped
@mkdir -p $(dir $@)
@echo "target Strip: $(PRIVATE_MODULE) ($@)"
$(hide) $(PRIVATE_STRIP) --strip-all $< -o $@ $(TARGET_STRIP_EXTRA)
$(hide) $(PRIVATE_STRIP) --strip-all $< -o $@ \
$(if $(PRIVATE_NO_DEBUGLINK),,$(TARGET_STRIP_EXTRA))
endef
define transform-to-stripped-keep-symbols

View File

@ -88,18 +88,21 @@ ifeq ($(my_strip_module),)
my_strip_module := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP_MODULE)
endif
ifeq ($(my_strip_module),true)
# Strip the binary
$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(transform-to-stripped)
else
ifeq ($(my_strip_module),keep_symbols)
# Strip only the debug frames, but leave the symbol table.
$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
$(strip_output): PRIVATE_READELF := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_READELF)
ifeq ($(my_strip_module),no_debuglink)
$(strip_output): PRIVATE_NO_DEBUGLINK := true
else
$(strip_output): PRIVATE_NO_DEBUGLINK :=
endif
ifneq ($(filter true no_debuglink,$(my_strip_module)),)
# Strip the binary
$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(transform-to-stripped)
else ifeq ($(my_strip_module),keep_symbols)
# Strip only the debug frames, but leave the symbol table.
$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(transform-to-stripped-keep-symbols)
@ -126,7 +129,6 @@ $(strip_output): $(strip_input)
@echo "target Unstripped: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target-with-cp)
endif
endif
endif # my_strip_module

View File

@ -76,8 +76,7 @@ $(foreach t,$(1), \
) \
) \
$(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \
$(if $(filter user,$(TARGET_BUILD_VARIANT)), \
$(eval LOCAL_STRIP_MODULE := $(8))) \
$(eval LOCAL_STRIP_MODULE := $(8)) \
$(eval include $(BUILD_PREBUILT)) \
)
endef

View File

@ -39,6 +39,10 @@ ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
# Put the built targets of all shared libraries in a common directory
# to simplify the link line.
OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_STRIP_MODULE),)
# Strip but not try to add debuglink
LOCAL_STRIP_MODULE := no_debuglink
endif
endif
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
@ -59,7 +63,7 @@ LOCAL_BUILT_MODULE_STEM := package.apk
LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk
endif
ifeq ($(LOCAL_STRIP_MODULE),true)
ifneq ($(filter true no_debuglink,$(LOCAL_STRIP_MODULE)),)
ifdef LOCAL_IS_HOST_MODULE
$(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
endif
@ -71,6 +75,7 @@ ifeq ($(LOCAL_STRIP_MODULE),true)
endif
include $(BUILD_SYSTEM)/dynamic_binary.mk
built_module := $(linked_module)
else # LOCAL_STRIP_MODULE not true
include $(BUILD_SYSTEM)/base_rules.mk
built_module := $(LOCAL_BUILT_MODULE)
@ -112,6 +117,8 @@ $(LOCAL_BUILT_MODULE) : $(my_built_shared_libraries)
endif
endif
# We need to enclose the above export_includes and built_shared_libraries in
# "LOCAL_STRIP_MODULE not true" because otherwise the rules are defined in dynamic_binary.mk.
endif # LOCAL_STRIP_MODULE not true
ifeq ($(LOCAL_MODULE_CLASS),APPS)