From 1742a32aea4108a8a967e8da2131de30c8808658 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 4 Feb 2015 17:35:49 -0800 Subject: [PATCH 1/4] Share LP32 makefile settings between arches Add _32 to patch-up-arch-specific-flags, and move the LP32 cruft varaibles from the 32-bit arch specific makefiles into the top level Android.mk. Change-Id: Id3fcf6805d4af048c2524c94b1295416ebe7d057 --- libc/Android.mk | 20 +++++++++++++++++++- libc/arch-arm/arm.mk | 18 ------------------ libc/arch-mips/mips.mk | 18 ------------------ libc/arch-x86/x86.mk | 18 ------------------ 4 files changed, 19 insertions(+), 55 deletions(-) diff --git a/libc/Android.mk b/libc/Android.mk index 691017a8b..503ae6f3f 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -513,6 +513,23 @@ libc_upstream_openbsd_src_files := \ libc_arch_static_src_files := \ bionic/dl_iterate_phdr_static.cpp \ +# Various kinds of LP32 cruft. +# ======================================================== +libc_bionic_src_files_32 += \ + bionic/mmap.cpp \ + +libc_common_src_files_32 += \ + bionic/legacy_32_bit_support.cpp \ + bionic/ndk_cruft.cpp \ + bionic/time64.c \ + +libc_netbsd_src_files_32 += \ + upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \ + +libc_openbsd_src_files_32 += \ + upstream-openbsd/lib/libc/stdio/putw.c \ + + # Define some common cflags # ======================================================== libc_common_cflags := \ @@ -569,12 +586,13 @@ libc_common_c_includes += \ $(LOCAL_PATH)/stdio \ # ======================================================== -# Add in the arch-specific flags. +# Add in the arch or 32-bit specific flags # Must be called with $(eval). # $(1): the LOCAL_ variable name # $(2): the bionic variable name to pull in define patch-up-arch-specific-flags $(1)_$(TARGET_ARCH) += $($(2)_$(TARGET_ARCH)) +$(1)_32 += $($(2)_32) ifdef TARGET_2ND_ARCH $(1)_$(TARGET_2ND_ARCH) += $($(2)_$(TARGET_2ND_ARCH)) endif diff --git a/libc/arch-arm/arm.mk b/libc/arch-arm/arm.mk index f712c4c69..60600e5fd 100644 --- a/libc/arch-arm/arm.mk +++ b/libc/arch-arm/arm.mk @@ -1,23 +1,5 @@ # 32-bit arm. -# -# Various kinds of LP32 cruft. -# - -libc_bionic_src_files_arm += \ - bionic/mmap.cpp \ - -libc_common_src_files_arm += \ - bionic/legacy_32_bit_support.cpp \ - bionic/ndk_cruft.cpp \ - bionic/time64.c \ - -libc_netbsd_src_files_arm += \ - upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \ - -libc_openbsd_src_files_arm += \ - upstream-openbsd/lib/libc/stdio/putw.c \ - # # Default implementations of functions that are commonly optimized. # diff --git a/libc/arch-mips/mips.mk b/libc/arch-mips/mips.mk index 7f36635fc..7e3fe25ae 100644 --- a/libc/arch-mips/mips.mk +++ b/libc/arch-mips/mips.mk @@ -1,23 +1,5 @@ # 32-bit mips. -# -# Various kinds of LP32 cruft. -# - -libc_bionic_src_files_mips += \ - bionic/mmap.cpp \ - -libc_common_src_files_mips += \ - bionic/legacy_32_bit_support.cpp \ - bionic/ndk_cruft.cpp \ - bionic/time64.c \ - -libc_netbsd_src_files_mips += \ - upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \ - -libc_openbsd_src_files_mips += \ - upstream-openbsd/lib/libc/stdio/putw.c \ - # # Default implementations of functions that are commonly optimized. # diff --git a/libc/arch-x86/x86.mk b/libc/arch-x86/x86.mk index 989690c61..e5d70a9d8 100644 --- a/libc/arch-x86/x86.mk +++ b/libc/arch-x86/x86.mk @@ -1,23 +1,5 @@ # 32-bit x86. -# -# Various kinds of LP32 cruft. -# - -libc_bionic_src_files_x86 += \ - bionic/mmap.cpp \ - -libc_common_src_files_x86 += \ - bionic/legacy_32_bit_support.cpp \ - bionic/ndk_cruft.cpp \ - bionic/time64.c \ - -libc_netbsd_src_files_x86 += \ - upstream-netbsd/common/lib/libc/hash/sha1/sha1.c \ - -libc_openbsd_src_files_x86 += \ - upstream-openbsd/lib/libc/stdio/putw.c \ - # # Default implementations of functions that are commonly optimized. # From 7dc502d01292f3303a5252ce20f80f621f4f15f5 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 4 Feb 2015 17:37:23 -0800 Subject: [PATCH 2/4] Remove libc_static_common_src_files libc_static_common_src_files is never set after c3f114037dbf028896310609fd28cf2b3da99c4d, remove the remaining references to it. Change-Id: I66364a5c1b031ad69d608f6f44244049192944f6 --- libc/Android.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libc/Android.mk b/libc/Android.mk index 503ae6f3f..c6a506688 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -1050,7 +1050,6 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ $(libc_arch_static_src_files) \ - $(libc_static_common_src_files) \ bionic/libc_init_static.cpp LOCAL_C_INCLUDES := $(libc_common_c_includes) @@ -1102,7 +1101,6 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ $(libc_arch_static_src_files) \ - $(libc_static_common_src_files) \ bionic/malloc_debug_common.cpp \ bionic/libc_init_static.cpp \ @@ -1137,7 +1135,6 @@ LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) LOCAL_SRC_FILES := \ $(libc_arch_dynamic_src_files) \ - $(libc_static_common_src_files) \ bionic/malloc_debug_common.cpp \ bionic/libc_init_dynamic.cpp \ bionic/NetdClient.cpp \ @@ -1173,7 +1170,6 @@ LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files)) -$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_static_common_src_files)) # special for arm LOCAL_NO_CRT_arm := true LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND From a6b6ed5fe9dd247684de5f35a0367be65876339e Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 4 Feb 2015 17:38:27 -0800 Subject: [PATCH 3/4] Fix typo in cpu variant makefile depenendency for arm64 cpu_variank_mk -> cpu_variant_mk Change-Id: I4b46ae20de72ed2dc8820d62ac35ddc6b915a195 --- libc/arch-arm64/arm64.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/arch-arm64/arm64.mk b/libc/arch-arm64/arm64.mk index ba78871c7..841899329 100644 --- a/libc/arch-arm64/arm64.mk +++ b/libc/arch-arm64/arm64.mk @@ -59,6 +59,6 @@ ifeq ($(wildcard $(cpu_variant_mk)),) $(error "TARGET_CPU_VARIANT not set or set to an unknown value. Possible values are generic, denver64. Use generic for devices that do not have a CPU similar to any of the supported cpu variants.") endif include $(cpu_variant_mk) -libc_common_additional_dependencies += $(cpu_variank_mk) +libc_common_additional_dependencies += $(cpu_variant_mk) cpu_variant_mk := From 5b869c0bbf8a2924ab69d86a98e9a25558d33494 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 4 Feb 2015 17:40:29 -0800 Subject: [PATCH 4/4] Use LOCAL_LDFLAGS_64 instead of enumerating 64-bit architectures LOCAL_LDFLAGS_ was being set for arm64, mips64, and x86_64. Use LOCAL_LDFLAGS_64 instead. Change-Id: Ib87855e8a7783f82461b707fffa7f1663e6be9c8 --- libc/Android.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libc/Android.mk b/libc/Android.mk index c6a506688..0fca92dee 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -1164,9 +1164,7 @@ LOCAL_SYSTEM_SHARED_LIBRARIES := # We'd really like to do this for all architectures, but since this wasn't done # before, these symbols must continue to be exported on LP32 for binary # compatibility. -LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a -LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a -LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a +LOCAL_LDFLAGS_64 := -Wl,--exclude-libs,libgcc.a $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags)) $(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_arch_dynamic_src_files))