Update make build system for dynamic unwinder.

Change the unwinder linking logic to match soong.

Bug: 144430859
Change-Id: I739980e479d14707b7a3afd6e9d2c817c9b43f81
This commit is contained in:
Peter Collingbourne 2019-12-10 18:42:11 -08:00
parent 52df8f5154
commit 86cdf9c2f4
5 changed files with 17 additions and 24 deletions

View File

@ -184,7 +184,6 @@ LOCAL_NDK_VERSION:=current
LOCAL_NO_CRT:=
LOCAL_NO_DEFAULT_COMPILER_FLAGS:=
LOCAL_NO_FPIE :=
LOCAL_NO_LIBGCC:=
LOCAL_NO_LIBCRT_BUILTINS:=
LOCAL_NO_NOTICE_FILE:=
LOCAL_NO_PIC:=

View File

@ -76,17 +76,27 @@ ifneq ($(filter $(my_cxx_stl),libc++ libc++_static),)
my_ldflags += -nostdlib++
else
my_static_libraries += libc++demangle
ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_static_libraries += libunwind_llvm
my_ldflags += -Wl,--exclude-libs,libunwind_llvm.a
endif
ifeq ($(my_link_type),static)
my_static_libraries += libm libc
ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_static_libraries += libunwind_llvm
my_ldflags += -Wl,--exclude-libs,libunwind_llvm.a
else
my_static_libraries += libgcc_stripped
my_ldflags += -Wl,--exclude-libs,libgcc_stripped.a
endif
endif
endif
else ifeq ($(my_cxx_stl),ndk)
# Using an NDK STL. Handled in binary.mk.
# Using an NDK STL. Handled in binary.mk, except for the unwinder.
ifeq (arm,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_static_libraries += libunwind_llvm
my_ldflags += -Wl,--exclude-libs,libunwind_llvm.a
else
my_static_libraries += libgcc_stripped
my_ldflags += -Wl,--exclude-libs,libgcc_stripped.a
endif
else ifeq ($(my_cxx_stl),libstdc++)
$(error $(LOCAL_PATH): $(LOCAL_MODULE): libstdc++ is not supported)
else ifeq ($(my_cxx_stl),none)

View File

@ -1717,7 +1717,6 @@ $(hide) $(PRIVATE_CXX_LINK) \
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
$(PRIVATE_TARGET_LIBCRT_BUILTINS) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_SHARED_LIBRARIES) \
@ -1753,7 +1752,6 @@ $(hide) $(PRIVATE_CXX_LINK) -pie \
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
$(PRIVATE_TARGET_LIBCRT_BUILTINS) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_SHARED_LIBRARIES) \
@ -1800,7 +1798,6 @@ $(hide) $(PRIVATE_CXX_LINK) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(filter %libcompiler_rt.a %libcompiler_rt.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_TARGET_LIBCRT_BUILTINS) \
$(PRIVATE_TARGET_LIBGCC) \
-Wl,--end-group \
$(PRIVATE_TARGET_CRTEND_O)
endef

View File

@ -41,11 +41,6 @@ my_target_libcrt_builtins :=
else
my_target_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS)
endif
ifeq ($(LOCAL_NO_LIBGCC),true)
my_target_libgcc :=
else
my_target_libgcc := $(call intermediates-dir-for,STATIC_LIBRARIES,libgcc,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libgcc.a
endif
my_target_libatomic := $(call intermediates-dir-for,STATIC_LIBRARIES,libatomic,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libatomic.a
ifeq ($(LOCAL_NO_CRT),true)
my_target_crtbegin_dynamic_o :=
@ -66,7 +61,6 @@ my_target_crtbegin_static_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_static.
my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o)
endif
$(linked_module): PRIVATE_TARGET_LIBCRT_BUILTINS := $(my_target_libcrt_builtins)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
@ -74,11 +68,11 @@ $(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o)
$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic) $(CLANG_CXX)
$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libatomic) $(CLANG_CXX)
$(transform-o-to-static-executable)
$(PRIVATE_POST_LINK_CMD)
else
$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic) $(CLANG_CXX)
$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libatomic) $(CLANG_CXX)
$(transform-o-to-executable)
$(PRIVATE_POST_LINK_CMD)
endif

View File

@ -39,11 +39,6 @@ my_target_libcrt_builtins :=
else
my_target_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS)
endif
ifeq ($(LOCAL_NO_LIBGCC),true)
my_target_libgcc :=
else
my_target_libgcc := $(call intermediates-dir-for,STATIC_LIBRARIES,libgcc,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libgcc.a
endif
my_target_libatomic := $(call intermediates-dir-for,STATIC_LIBRARIES,libatomic,,,$(LOCAL_2ND_ARCH_VAR_PREFIX))/libatomic.a
ifeq ($(LOCAL_NO_CRT),true)
my_target_crtbegin_so_o :=
@ -60,7 +55,6 @@ my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o)
my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o)
endif
$(linked_module): PRIVATE_TARGET_LIBCRT_BUILTINS := $(my_target_libcrt_builtins)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
@ -71,7 +65,6 @@ $(linked_module): \
$(my_target_crtbegin_so_o) \
$(my_target_crtend_so_o) \
$(my_target_libcrt_builtins) \
$(my_target_libgcc) \
$(my_target_libatomic) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(CLANG_CXX)
$(transform-o-to-shared-lib)