summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2015-12-25 11:22:17 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2015-12-25 11:22:17 +0800
commitf97a321bacd17bf093bc53eebcb21119d63240bd (patch)
tree80803308cd42a5c5eb7e0d705df9c73fa13b6a21
parent91eebb25259df06c4719ad33c82b452a95d232c7 (diff)
Add Makefile and script to build static binary for 64bit android platform
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--android-tools/static-binary/src/Makefile.641
-rw-r--r--android-tools/static-binary/src/Makefile.64.good67
-rw-r--r--android-tools/static-binary/src/main_strcpy.c7
-rwxr-xr-xandroid-tools/static-binary/src/static_compile.sh285
-rw-r--r--android-tools/static-binary/src/strcpy_nexus925
-rwxr-xr-xandroid-tools/static-binary/src/test_strcpy.sh17
6 files changed, 187 insertions, 215 deletions
diff --git a/android-tools/static-binary/src/Makefile.64 b/android-tools/static-binary/src/Makefile.64
index ab2efcd..347e471 100644
--- a/android-tools/static-binary/src/Makefile.64
+++ b/android-tools/static-binary/src/Makefile.64
@@ -89,7 +89,6 @@ CFLAGS_OPTIONS_EXTRA := \
-frename-registers \
-DNDEBUG \
-UDEBUG \
- -fpie \
-D_USING_LIBCXX \
-Werror=int-to-pointer-cast \
-Werror=pointer-to-int-cast \
diff --git a/android-tools/static-binary/src/Makefile.64.good b/android-tools/static-binary/src/Makefile.64.good
index 5977de3..1cdc7a7 100644
--- a/android-tools/static-binary/src/Makefile.64.good
+++ b/android-tools/static-binary/src/Makefile.64.good
@@ -2,14 +2,13 @@ BASE=/data/armv8/marshmallow/
NDK=/SATA3/android-ndk-r10e/
SYSROOT=$(NDK)/platforms/android-21/arch-arm64/
-
TOOLCHAIN_GOOGLE_64=$(BASE)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/
INCLUDE_GOOGLE_64=$(OOLCHAIN_GOOGLE_64)/lib/gcc/aarch64-linux-android/4.9.x-google/include
-CC_google_64=$(TOOLCHAIN_GOOGLE_64)/bin/aarch64-linux-android-gcc
+CC_google_64=$(TOOLCHAIN_GOOGLE_64)/bin/aarch64-linux-android-g++
TOOLCHAIN_LINARO_64=$(BASE)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-5.3-linaro/
INCLUDE_LINARO_64=$(OOLCHAIN_LINARO_64)/lib/gcc/aarch64-linux-android/5.3.0/include
-CC_linaro_64=$(TOOLCHAIN_LINARO_64)/bin/aarch64-linux-android-gcc
+CC_linaro_64=$(TOOLCHAIN_LINARO_64)/bin/aarch64-linux-android-g++
CFLAGS_INCLUDES := \
-isystem $(BASE)/bionic/libc/arch-arm64/include \
@@ -43,6 +42,7 @@ CFLAGS_OPTIONS_GOOD := \
-std=c11 \
-O2
+# not really necessry but help on more check
CFLAGS_OPTIONS_EXTRA := \
-fno-exceptions \
-Wno-multichar \
@@ -57,7 +57,6 @@ CFLAGS_OPTIONS_EXTRA := \
-Werror=non-virtual-dtor \
-Werror=address \
-Werror=sequence-point \
- -DNDEBUG \
-g \
-Wstrict-aliasing=2 \
-fgcse-after-reload \
@@ -65,7 +64,6 @@ CFLAGS_OPTIONS_EXTRA := \
-frename-registers \
-DNDEBUG \
-UDEBUG \
- -fpie \
-D_USING_LIBCXX \
-Werror=int-to-pointer-cast \
-Werror=pointer-to-int-cast \
@@ -83,15 +81,6 @@ LDFLAGS_OPTIONS_GOOD := \
-Wl,--allow-shlib-undefined \
-Wl,--no-undefined \
-LDFLAGS_OPTIONS_EXTRA := \
- -Wl,--gc-sections \
-
-all: strcpy_test_linaro \
- strcpy_test_linaro_static \
- strcpy_test_google \
- strcpy_test_google_static \
- move
-
#############################################################################
############## meanings of GCC options ######################################
#############################################################################
@@ -136,9 +125,11 @@ all: strcpy_test_linaro \
# -msoft-float
# Use library routines for floating-point operations.
+# Not supported by aarch64 gcc
# -mhard-float
# Use hardware instructions for floating-point operations.
+# Not supported by aarch64 gcc
# -static
# On systems that support dynamic linking, this prevents linking with the shared libraries.
@@ -163,46 +154,48 @@ all: strcpy_test_linaro \
# Produce a position independent executable on targets that support it.
# For predictable results, you must also specify the same set of options used for compilation (-fpie, -fPIE, or model suboptions) when you specify this linker option.
-#src := main_strcpy.c Makefile.64 string_copy_linaro_wrapper.S string_copy_linaro.S string_copy_google_wrapper.S string_copy_google.S
src := main_strcpy.c string_copy_linaro_wrapper.S string_copy_google_wrapper.S
-#src += asm/asm.h asm/bionic_asm.h asm/bitsperlong.h asm/unistd.h
+# no need to list asm source files that is included in the .S file
+# src += asm/asm.h asm/bionic_asm.h asm/bitsperlong.h asm/unistd.h
+
+## -Wl,--gc-sections -Wl,--whole-archive -Wl,--no-whole-archive and -D_USING_LIBCXX help on building the static link binary
+all: strcpy_test_linaro \
+ strcpy_test_linaro_static \
+ strcpy_test_google \
+ strcpy_test_google_static \
+ move
-## -mfloat-abi=softfp and -mhard-float are not supported by aarch64 gcc
strcpy_test_linaro_static: $(src)
- $(CC_linaro_64) $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(LDFLAGS_OPTIONS_GOOD) \
- -nostdlib -static -Bstatic -static-libgcc -static-libstdc++ -lgcc\
- $^ -o $@ \
- /SATA3/android-ndk-r10e/platforms/android-21/arch-arm64/usr/lib/crtbegin_static.o \
- -pie \
- -Wl,--start-group $(BASE)/development/ndk/platforms/android-21/arch-arm64/lib/libc.a \
- $(TOOLCHAIN_LINARO_64)/lib/gcc/aarch64-linux-android/5.3.0/libgcc.a \
- -Wl,--end-group $(BASE)/development/ndk/platforms/android-21/arch-arm64/lib-bootstrap/crtend_android.o \
+ $(CC_linaro_64) \
+ $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(CFLAGS_OPTIONS_EXTRA) $(LDFLAGS_OPTIONS_GOOD) \
+ -nostdlib -static -Bstatic -D_USING_LIBCXX -Wl,--gc-sections -Wl,--whole-archive -Wl,--no-whole-archive \
+ -o $@ $^ $(SYSROOT)/usr/lib/crtbegin_static.o \
+ -Wl,--start-group $(SYSROOT)/usr/lib/libc.a $(TOOLCHAIN_LINARO_64)/lib/gcc/aarch64-linux-android/5.3.0/libgcc.a \
+ -Wl,--end-group $(SYSROOT)/usr/lib/crtend_android.o
strcpy_test_google_static: $(src)
- $(CC_google_64) $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(LDFLAGS_OPTIONS_GOOD) \
- -nostdlib -static -Bstatic -static-libgcc -static-libstdc++ -lgcc\
- $^ -o $@ \
- /SATA3/android-ndk-r10e/platforms/android-21/arch-arm64/usr/lib/crtbegin_static.o \
- -fPIE -pie \
- -Wl,--start-group $(BASE)/development/ndk/platforms/android-21/arch-arm64/lib/libc.a \
- $(TOOLCHAIN_GOOGLE_64)/aarch64-linux-android/lib64/libatomic.a $(TOOLCHAIN_GOOGLE_64)/lib/gcc/aarch64-linux-android/4.9.x-google/libgcc.a \
- -Wl,--end-group $(BASE)/development/ndk/platforms/android-21/arch-arm64/lib-bootstrap/crtend_android.o \
+ $(CC_google_64) \
+ $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(CFLAGS_OPTIONS_EXTRA) $(LDFLAGS_OPTIONS_GOOD) \
+ -nostdlib -static -Bstatic -D_USING_LIBCXX -Wl,--gc-sections -Wl,--whole-archive -Wl,--no-whole-archive \
+ -o $@ $^ $(SYSROOT)/usr/lib/crtbegin_static.o \
+ -Wl,--start-group $(SYSROOT)/usr/lib/libc.a $(TOOLCHAIN_GOOGLE_64)/lib/gcc/aarch64-linux-android/4.9.x-google/libgcc.a \
+ -Wl,--end-group $(SYSROOT)/usr/lib/crtend_android.o
strcpy_test_linaro: $(src)
- $(CC_linaro_64) $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(LDFLAGS_OPTIONS_GOOD) \
+ $(CC_linaro_64) $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(CFLAGS_OPTIONS_EXTRA) $(LDFLAGS_OPTIONS_GOOD) \
--sysroot=$(SYSROOT) \
-fPIE -pie \
$^ -o $@
strcpy_test_google: $(src)
- $(CC_google_64) $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(LDFLAGS_OPTIONS_GOOD) \
+ $(CC_google_64) $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(CFLAGS_OPTIONS_EXTRA) $(LDFLAGS_OPTIONS_GOOD) \
--sysroot=$(SYSROOT) \
-fPIE -pie \
$^ -o $@
move:
@mkdir -p bin/
- @mv strcpy_test* bin/
+ @mv -v strcpy_test* bin/
clean:
- rm -f bin/strcpy_test*
+ rm -vf bin/strcpy_test*
diff --git a/android-tools/static-binary/src/main_strcpy.c b/android-tools/static-binary/src/main_strcpy.c
index 5da42d7..d730d1e 100644
--- a/android-tools/static-binary/src/main_strcpy.c
+++ b/android-tools/static-binary/src/main_strcpy.c
@@ -3,13 +3,14 @@
#include <stdio.h>
#include <sys/time.h>
-void *strcpy_google(void *dest, const void *src);
-void *strcpy_linaro(void *dest, const void *src);
+// need to be defined without [ extern "C" ] when compile with gcc
+extern "C" void *strcpy_google(void *dest, const void *src);
+extern "C" void *strcpy_linaro(void *dest, const void *src);
#define START gettimeofday(&tv1, 0);
#define END(x) gettimeofday(&tv2, 0); t1 = ((double)tv1.tv_sec)+((double)tv1.tv_usec)/1000000.0; t2 = ((double)tv2.tv_sec)+((double)tv2.tv_usec)/1000000.0; printf("%s: %f seconds\n", x, t2-t1)
-int main(int argc, char **argv) {
+int main() {
struct timeval tv1, tv2;
double t1, t2;
char * const s = (char * const) malloc(16);
diff --git a/android-tools/static-binary/src/static_compile.sh b/android-tools/static-binary/src/static_compile.sh
index 84319a1..52c3ada 100755
--- a/android-tools/static-binary/src/static_compile.sh
+++ b/android-tools/static-binary/src/static_compile.sh
@@ -25,199 +25,137 @@ function compile(){
exit 1
fi
rm -vfr "${output}" main_strcpy.o string_copy_google_wrapper.o string_copy_linaro_wrapper.o
-
+
+ cflags_include="-isystem ${BASE}/bionic/libc/arch-arm64/include \
+ -isystem ${BASE}/bionic/libc/include \
+ -isystem ${BASE}/bionic/libc/kernel/uapi \
+ -isystem ${BASE}/bionic/libc/kernel/uapi/asm-arm64 \
+ -isystem ${BASE}/bionic/libm/include \
+ -isystem ${BASE}/bionic/libm/include/arm64 \
+ -include ${BASE}/build/core/combo/include/arch/linux-arm64/AndroidConfig.h \
+ -I ${BASE}/build/core/combo/include/arch/linux-arm64/"
+
+ cflags_foptions="-fno-exceptions \
+ -fno-strict-aliasing \
+ -fstack-protector \
+ -ffunction-sections \
+ -fdata-sections \
+ -funwind-tables \
+ -fno-short-enums \
+ -fno-canonical-system-headers \
+ -fno-strict-volatile-bitfields \
+ -fmessage-length=0 \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers"
+
+ cflags_Woptions="-Wno-multichar \
+ -Wa,--noexecstack \
+ -Werror=format-security \
+ -Werror=pointer-to-int-cast \
+ -Werror=int-to-pointer-cast \
+ -Werror=implicit-function-declaration \
+ -W \
+ -Wall \
+ -Wno-unused \
+ -Winit-self \
+ -Wpointer-arith \
+ -Werror=return-type \
+ -Werror=non-virtual-dtor \
+ -Werror=address \
+ -Werror=sequence-point \
+ -Wno-psabi \
+ -Wstrict-aliasing=2"
+
+ cflags_Doptions="-D_FORTIFY_SOURCE=2 \
+ -DANDROID \
+ -DNDEBUG \
+ -UDEBUG"
+ cflags_misc="-c \
+ -O2 \
+ -g \
+ -no-canonical-prefixes \
+ -mcpu=cortex-a53"
+
+ cflags_misc2="-O2 \
+ -g \
+ -no-canonical-prefixes \
+ -mcpu=cortex-a53"
+
+ cflags_common="${cflags_include} \
+ ${cflags_misc} \
+ ${cflags_foptions} \
+ ${cflags_Woptions} \
+ ${cflags_Doptions}"
+
+ cflags_common2="${cflags_include} \
+ ${cflags_misc2} \
+ ${cflags_foptions} \
+ ${cflags_Woptions} \
+ ${cflags_Doptions}"
+
+ ldflag_options="-nostdlib -Bstatic -static \
+ -Wl,--gc-sections \
+ -Wl,-z,noexecstack \
+ -Wl,-z,relro -Wl,-z,now \
+ -Wl,--build-id=md5 \
+ -Wl,--warn-shared-textrel \
+ -Wl,--fatal-warnings \
+ -Wl,-maarch64linux \
+ -Wl,--hash-style=gnu \
+ -Wl,--fix-cortex-a53-843419 \
+ -Wl,--allow-shlib-undefined \
+ -Wl,--no-undefined \
+ -Wl,--whole-archive \
+ -Wl,--no-whole-archive \
+ "
+
+if false; then
${toolchain}/bin/aarch64-linux-android-gcc \
- -isystem ${BASE}/bionic/libc/arch-arm64/include \
- -isystem ${BASE}/bionic/libc/include \
- -isystem ${BASE}/bionic/libc/kernel/uapi \
- -isystem ${BASE}/bionic/libc/kernel/uapi/asm-arm64 \
- -isystem ${BASE}/bionic/libm/include \
- -isystem ${BASE}/bionic/libm/include/arm64 \
- -include ${BASE}/build/core/combo/include/arch/linux-arm64/AndroidConfig.h \
- -I ${BASE}/build/core/combo/include/arch/linux-arm64/ \
- -c \
- -fno-exceptions \
- -Wno-multichar \
- -fno-strict-aliasing \
- -fstack-protector \
- -ffunction-sections \
- -fdata-sections \
- -funwind-tables \
- -Wa,--noexecstack \
- -Werror=format-security \
- -D_FORTIFY_SOURCE=2 \
- -fno-short-enums \
- -no-canonical-prefixes \
- -fno-canonical-system-headers \
- -mcpu=cortex-a53 \
- -Werror=pointer-to-int-cast \
- -Werror=int-to-pointer-cast \
- -Werror=implicit-function-declaration \
- -fno-strict-volatile-bitfields \
- -Wno-psabi \
- -DANDROID \
- -fmessage-length=0 \
- -W \
- -Wall \
- -Wno-unused \
- -Winit-self \
- -Wpointer-arith \
- -Werror=return-type \
- -Werror=non-virtual-dtor \
- -Werror=address \
- -Werror=sequence-point \
- -O2 \
- -DNDEBUG \
- -g \
- -Wstrict-aliasing=2 \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -DNDEBUG \
- -UDEBUG \
+ ${cflags_common} \
-D__ASSEMBLY__ \
-o string_copy_google_wrapper.o \
string_copy_google_wrapper.S
${toolchain}/bin/aarch64-linux-android-gcc \
- -isystem ${BASE}/bionic/libc/arch-arm64/include \
- -isystem ${BASE}/bionic/libc/include \
- -isystem ${BASE}/bionic/libc/kernel/uapi \
- -isystem ${BASE}/bionic/libc/kernel/uapi/asm-arm64 \
- -isystem ${BASE}/bionic/libm/include \
- -isystem ${BASE}/bionic/libm/include/arm64 \
- -include ${BASE}/build/core/combo/include/arch/linux-arm64/AndroidConfig.h \
- -I ${BASE}/build/core/combo/include/arch/linux-arm64/ \
- -c \
- -fno-exceptions \
- -Wno-multichar \
- -fno-strict-aliasing \
- -fstack-protector \
- -ffunction-sections \
- -fdata-sections \
- -funwind-tables \
- -Wa,--noexecstack \
- -Werror=format-security \
- -D_FORTIFY_SOURCE=2 \
- -fno-short-enums \
- -no-canonical-prefixes \
- -fno-canonical-system-headers \
- -mcpu=cortex-a53 \
- -Werror=pointer-to-int-cast \
- -Werror=int-to-pointer-cast \
- -Werror=implicit-function-declaration \
- -fno-strict-volatile-bitfields \
- -Wno-psabi \
- -DANDROID \
- -fmessage-length=0 \
- -W \
- -Wall \
- -Wno-unused \
- -Winit-self \
- -Wpointer-arith \
- -Werror=return-type \
- -Werror=non-virtual-dtor \
- -Werror=address \
- -Werror=sequence-point \
- -O2 \
- -DNDEBUG \
- -g \
- -Wstrict-aliasing=2 \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -DNDEBUG \
- -UDEBUG \
+ ${cflags_common} \
-D__ASSEMBLY__ \
-o string_copy_linaro_wrapper.o \
string_copy_linaro_wrapper.S
-
+
${toolchain}/bin/aarch64-linux-android-gcc \
- -isystem ${BASE}/bionic/libc/arch-arm64/include \
- -isystem ${BASE}/bionic/libc/include \
- -isystem ${BASE}/bionic/libc/kernel/uapi \
- -isystem ${BASE}/bionic/libc/kernel/uapi/asm-arm64 \
- -isystem ${BASE}/bionic/libm/include \
- -isystem ${BASE}/bionic/libm/include/arm64 \
- -include ${BASE}/build/core/combo/include/arch/linux-arm64/AndroidConfig.h \
- -I ${BASE}/build/core/combo/include/arch/linux-arm64/ \
- -c \
- -fno-exceptions \
- -Wno-multichar \
- -fno-strict-aliasing \
- -fstack-protector \
- -ffunction-sections \
- -fdata-sections \
- -funwind-tables \
- -Wa,--noexecstack \
- -Werror=format-security \
- -D_FORTIFY_SOURCE=2 \
- -fno-short-enums \
- -no-canonical-prefixes \
- -fno-canonical-system-headers \
- -mcpu=cortex-a53 \
- -Werror=pointer-to-int-cast \
- -Werror=int-to-pointer-cast \
- -Werror=implicit-function-declaration \
- -fno-strict-volatile-bitfields \
- -Wno-psabi \
- -DANDROID \
- -fmessage-length=0 \
- -W \
- -Wall \
- -Wno-unused \
- -Winit-self \
- -Wpointer-arith \
- -Werror=return-type \
- -Werror=non-virtual-dtor \
- -Werror=address \
- -Werror=sequence-point \
- -O2 \
- -DNDEBUG \
- -g \
- -Wstrict-aliasing=2 \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -DNDEBUG \
- -UDEBUG \
- -std=gnu99 \
- -fpie \
+ ${cflags_common} \
-D_USING_LIBCXX \
- -Werror=int-to-pointer-cast \
- -Werror=pointer-to-int-cast \
+ -std=c11 \
+ -fpie \
+ -Werror=int-to-pointer-cast -Werror=pointer-to-int-cast \
-o main_strcpy.o \
main_strcpy.c
-
-
+
${toolchain}/bin/aarch64-linux-android-gcc \
- -nostdlib \
- -Bstatic \
- -static \
- -Wl,--gc-sections \
+ ${ldflag_options} \
+ -o "${output}" \
string_copy_linaro_wrapper.o \
- string_copy_google_wrapper.o \
- main_strcpy.o \
- -o "${output}" \
+ string_copy_google_wrapper.o \
+ main_strcpy.o \
${NDK_21_ARM64}/usr/lib/crtbegin_static.o \
- -Wl,-z,noexecstack \
- -Wl,-z,relro -Wl,-z,now \
- -Wl,--build-id=md5 \
- -Wl,--warn-shared-textrel \
- -Wl,--fatal-warnings \
- -Wl,-maarch64linux \
- -Wl,--hash-style=gnu \
- -Wl,--fix-cortex-a53-843419 \
- -Wl,--allow-shlib-undefined \
- -Wl,--no-undefined \
- -Wl,--whole-archive \
- -Wl,--no-whole-archive \
- -Wl,--start-group \
+ -Wl,--start-group \
${NDK_21_ARM64}/usr/lib/libc.a \
${libgcc} \
-Wl,--end-group \
${NDK_21_ARM64}/usr/lib/crtend_android.o
-
+fi
+ ${toolchain}/bin/aarch64-linux-android-gcc \
+ ${cflags_common2} -std=c11 -D_USING_LIBCXX \
+ ${ldflag_options} \
+ -o "${output}" \
+ string_copy_linaro_wrapper.S \
+ string_copy_google_wrapper.S \
+ main_strcpy.c \
+ ${NDK_21_ARM64}/usr/lib/crtbegin_static.o \
+ -Wl,--start-group ${NDK_21_ARM64}/usr/lib/libc.a ${libgcc} \
+ -Wl,--end-group ${NDK_21_ARM64}/usr/lib/crtend_android.o
+
ls -l "${output}"
file "${output}"
}
@@ -232,4 +170,3 @@ function main(){
}
main "$@"
-
diff --git a/android-tools/static-binary/src/strcpy_nexus9 b/android-tools/static-binary/src/strcpy_nexus9
new file mode 100644
index 0000000..58b3360
--- /dev/null
+++ b/android-tools/static-binary/src/strcpy_nexus9
@@ -0,0 +1,25 @@
+======= Start test for strcpy_test_linaro =================
+1000000 * strcpy_google of 15000 bytes: 1.978911 seconds
+100000000 * strcpy_google of 15 bytes: 0.964675 seconds
+1000000 * strcpy_linaro of 15000 bytes: 1.961538 seconds
+100000000 * strcpy_linaro of 15 bytes: 0.334581 seconds
+======= End test for strcpy_test_linaro =================
+======= Start test for strcpy_test_google =================
+1000000 * strcpy_google of 15000 bytes: 1.981997 seconds
+100000000 * strcpy_google of 15 bytes: 0.970816 seconds
+1000000 * strcpy_linaro of 15000 bytes: 1.966611 seconds
+100000000 * strcpy_linaro of 15 bytes: 0.263881 seconds
+======= End test for strcpy_test_google =================
+======= Start test for strcpy_test_linaro_static =================
+1000000 * strcpy_google of 15000 bytes: 1.998843 seconds
+100000000 * strcpy_google of 15 bytes: 0.974423 seconds
+1000000 * strcpy_linaro of 15000 bytes: 1.972505 seconds
+100000000 * strcpy_linaro of 15 bytes: 0.560453 seconds
+======= End test for strcpy_test_linaro_static =================
+======= Start test for strcpy_test_google_static =================
+1000000 * strcpy_google of 15000 bytes: 1.980395 seconds
+100000000 * strcpy_google of 15 bytes: 0.921233 seconds
+1000000 * strcpy_linaro of 15000 bytes: 1.873095 seconds
+100000000 * strcpy_linaro of 15 bytes: 0.319051 seconds
+======= End test for strcpy_test_google_static =================
+
diff --git a/android-tools/static-binary/src/test_strcpy.sh b/android-tools/static-binary/src/test_strcpy.sh
new file mode 100755
index 0000000..b096877
--- /dev/null
+++ b/android-tools/static-binary/src/test_strcpy.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+adb shell rm -fr /data/local/tmp/bin
+adb push bin/ /data/local/tmp/bin
+
+function echo_and_run(){
+ local cmd=$1
+ if [ -z "$cmd" ];then
+ return
+ fi
+ echo ======= Start test for $cmd =================
+ adb shell /data/local/tmp/bin/$cmd
+ echo ======= End test for $cmd =================
+}
+echo_and_run strcpy_test_linaro
+echo_and_run strcpy_test_google
+echo_and_run strcpy_test_linaro_static
+echo_and_run strcpy_test_google_static