Reconfig libc's Android.mk to build for multilib
1. Moved arch-specific setup to their own files:
- <arch>/<arch>.mk, arch-specific configs. Variables in those config
end with the arch name.
- removed the extra complexity introduced by function libc-add-cpu-variant-src,
which seems to be not very useful these days.
2. Separated out the crt object files generation rules and set up the
rules for both TARGET_ARCH and TARGET_2ND_ARCH.
3. Build all the libraries for both TARGET_ARCH and TARGET_2ND_ARCH,
with the arch-specific LOCAL_ variables.
Bug: 11654773
Change-Id: I9c2d85db0affa49199d182236d2210060a321421
diff --git a/libc/arch-mips/mips.mk b/libc/arch-mips/mips.mk
index aa8e1ff..4e007e5 100644
--- a/libc/arch-mips/mips.mk
+++ b/libc/arch-mips/mips.mk
@@ -1,4 +1,59 @@
-_LIBC_ARCH_COMMON_SRC_FILES := \
+# mips specific configs
+
+# These are shared by all the 32-bit targets, but not the 64-bit ones.
+libc_common_src_files_mips := \
+ bionic/legacy_32_bit_support.cpp \
+ bionic/ndk_cruft.cpp \
+
+# These are shared by all the 32-bit targets, but not the 64-bit ones.
+libc_bionic_src_files_mips += \
+ bionic/mmap.cpp
+
+libc_common_src_files_mips += \
+ bionic/memchr.c \
+ bionic/memcmp.c \
+ bionic/memmove.c \
+ bionic/memrchr.c \
+ bionic/strchr.cpp \
+ bionic/strnlen.c \
+ string/bcopy.c \
+ string/index.c \
+ string/strcat.c \
+ string/strcmp.c \
+ string/strcpy.c \
+ string/strlcat.c \
+ string/strlcpy.c \
+ string/strncat.c \
+ string/strncmp.c \
+ string/strncpy.c \
+ string/strrchr.c \
+ upstream-freebsd/lib/libc/string/wcscat.c \
+ upstream-freebsd/lib/libc/string/wcschr.c \
+ upstream-freebsd/lib/libc/string/wcscmp.c \
+ upstream-freebsd/lib/libc/string/wcscpy.c \
+ upstream-freebsd/lib/libc/string/wcslen.c \
+ upstream-freebsd/lib/libc/string/wcsrchr.c \
+ upstream-freebsd/lib/libc/string/wmemcmp.c \
+
+# Fortify implementations of libc functions.
+libc_common_src_files_mips += \
+ bionic/__memcpy_chk.cpp \
+ bionic/__memset_chk.cpp \
+ bionic/__strcpy_chk.cpp \
+ bionic/__strcat_chk.cpp \
+
+
+# cflags
+ifneq ($(ARCH_MIPS_HAS_FPU),true)
+libc_common_cflags_mips := \
+ -DSOFTFLOAT
+endif
+libc_common_cflags_mips += \
+ -fstrict-aliasing
+
+##########################################
+### CPU specific source files
+libc_bionic_src_files_mips += \
arch-mips/bionic/__bionic_clone.S \
arch-mips/bionic/bzero.S \
arch-mips/bionic/cacheflush.cpp \
@@ -15,3 +70,25 @@
arch-mips/string/memcpy.S \
arch-mips/string/memset.S \
arch-mips/string/mips_strlen.c \
+
+# These are used by the static and dynamic versions of the libc
+# respectively.
+libc_arch_static_src_files_mips :=
+
+libc_arch_dynamic_src_files_mips :=
+
+
+##########################################
+# crt-related
+libc_crt_target_cflags_mips := \
+ $($(my_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
+ -I$(LOCAL_PATH)/arch-mips/include
+
+libc_crt_target_crtbegin_file_mips := \
+ $(LOCAL_PATH)/arch-mips/bionic/crtbegin.c
+
+libc_crt_target_crtbegin_so_file_mips := \
+ $(LOCAL_PATH)/arch-common/bionic/crtbegin_so.c
+
+libc_crt_target_so_cflags_mips := \
+ -fPIC