From 0e5ce8be34446278a3404ea2a4afc01f20f86c5a Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Fri, 23 May 2014 10:41:29 -0700 Subject: [PATCH] Fix for duplicate names in whole static libs _extract-and-include-single-(host|target)-whole-static-lib was written such that only the first file of a given name would be extracted and included into the new library. This patch iterates over each identically named archive member, extracts them individually, and adds them to the new archive. Bug: 15110069 Change-Id: Ia08c7be6f40bfc8403908a8808898ada479099b1 --- core/combo/select.mk | 2 +- core/definitions.mk | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/combo/select.mk b/core/combo/select.mk index 8234a8fcb1..506ad08e71 100644 --- a/core/combo/select.mk +++ b/core/combo/select.mk @@ -53,7 +53,7 @@ $(combo_var_prefix)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar $(combo_var_prefix)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing $(combo_var_prefix)GLOBAL_CPPFLAGS := $(combo_var_prefix)GLOBAL_LDFLAGS := -$(combo_var_prefix)GLOBAL_ARFLAGS := crsPD +$(combo_var_prefix)GLOBAL_ARFLAGS := cqsPD $(combo_var_prefix)GLOBAL_LD_DIRS := $(combo_var_prefix)EXECUTABLE_SUFFIX := diff --git a/core/definitions.mk b/core/definitions.mk index e35d36fec5..7e69d11392 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1167,16 +1167,16 @@ endef # $(1): the full path of the source static library. define _extract-and-include-single-target-whole-static-lib @echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]" -$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\ - rm -rf $$ldir; \ - mkdir -p $$ldir; \ - filelist=; \ - for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) t $(1)`; do \ - $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) p $(1) $$f > $$ldir/$$f; \ - filelist="$$filelist $$ldir/$$f"; \ - done ; \ - $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \ - $(PRIVATE_ARFLAGS) $@ $$filelist +$(hide) \ + for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) t $(1) | sort | uniq`; do \ + i=0; \ + for ff in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) t $(1) $$f`; do \ + i=$$(($$i + 1)); \ + $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) xN $$i $(1) $$f; \ + $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) \ + $(PRIVATE_ARFLAGS) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) $@ $$f; \ + done ; \ + done ; endef @@ -1204,16 +1204,16 @@ endef # $(1): the full path of the source static library. define _extract-and-include-single-host-whole-static-lib @echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]" -$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\ - rm -rf $$ldir; \ - mkdir -p $$ldir; \ - filelist=; \ - for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) t $(1) | \grep '\.o$$'`; do \ - $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) p $(1) $$f > $$ldir/$$f; \ - filelist="$$filelist $$ldir/$$f"; \ - done ; \ - $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \ - $(PRIVATE_ARFLAGS) $@ $$filelist +$(hide) \ + for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) t $(1) | \grep '\.o$$' | sort | uniq`; do \ + i=0; \ + for ff in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) t $(1) $$f`; do \ + i=$$(($$i + 1)); \ + $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) xN $$i $(1) $$f; \ + $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) \ + $(PRIVATE_ARFLAGS) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) $@ $$f; \ + done ; \ + done ; endef