From b2680757a07bfd16efae3c8710c69b14807f425f Mon Sep 17 00:00:00 2001 From: Shih-wei Liao Date: Wed, 2 May 2012 04:41:41 -0700 Subject: [PATCH] Members in LOCAL_WHOLE_STATIC_LIBRARIES should be force_loaded. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For Mac build, force_load the LOCAL_WHOLE_STATIC_LIBRARIES. Mac has its custom linker. However, its linking rule for generating shared libraries doesn’t take the LOCAL_WHOLE_STATIC_LIBRARIES into consideration. Change-Id: Ia6858bf6e2ebb334db8f3d0bdc71d7ecc0ef11c1 --- core/combo/HOST_darwin-x86.mk | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk index 198c53f4f..ff4bbb542 100644 --- a/core/combo/HOST_darwin-x86.mk +++ b/core/combo/HOST_darwin-x86.mk @@ -69,31 +69,13 @@ HOST_GLOBAL_ARFLAGS := cqs HOST_CUSTOM_LD_COMMAND := true -# Workaround for lack of "-Wl,--whole-archive" in MacOS's linker. -define _darwin-extract-and-include-single-whole-static-lib -@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]" -$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\ - mkdir -p $$ldir; \ - for f in `$(HOST_AR) t $(1)`; do \ - $(HOST_AR) p $(1) $$f > $$ldir/$$f; \ - done ; - -endef - -define darwin-extract-and-include-whole-static-libs -$(if $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), $(hide) rm -rf $(PRIVATE_INTERMEDIATES_DIR)/WHOLE) -$(foreach lib,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), \ - $(call _darwin-extract-and-include-single-whole-static-lib, $(lib))) -endef - define transform-host-o-to-shared-lib-inner -$(call darwin-extract-and-include-whole-static-libs) $(hide) $(PRIVATE_CXX) \ -dynamiclib -single_module -read_only_relocs suppress \ $(HOST_GLOBAL_LD_DIRS) \ $(HOST_GLOBAL_LDFLAGS) \ $(PRIVATE_ALL_OBJECTS) \ - $(if $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES), `find $(PRIVATE_INTERMEDIATES_DIR)/WHOLE -name '*.o' 2>/dev/null`) \ + $(addprefix -force_load , $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \ $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \ $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \