Link libgcc.a before shared libraries (especially libc.so).

[cherry-picked from internal master]

Change-Id: I53d19754d0d40e9ca2f3d043001cc77e39e5d795
This commit is contained in:
Ben Cheng 2013-03-12 18:15:18 -07:00
parent 0ec2f3df4b
commit 6c7bc550ad
1 changed files with 4 additions and 2 deletions

View File

@ -247,6 +247,7 @@ $(hide) $(PRIVATE_CXX) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_TARGET_LIBGCC) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@ -261,10 +262,8 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
@ -273,6 +272,9 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(PRIVATE_TARGET_LIBGCC) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_TARGET_FDO_LIB) \