summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2015-12-25 11:24:50 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2015-12-25 11:24:50 +0800
commit82faa8ecca558c357cafd02f33497b55b0448245 (patch)
tree601a531fdf2522182f785176e46af725d7cbcc4b
parentf97a321bacd17bf093bc53eebcb21119d63240bd (diff)
override Makefile.64 with Makefile.64.good
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--android-tools/static-binary/src/Makefile.64116
-rw-r--r--android-tools/static-binary/src/Makefile.64.good201
2 files changed, 48 insertions, 269 deletions
diff --git a/android-tools/static-binary/src/Makefile.64 b/android-tools/static-binary/src/Makefile.64
index 347e471..1cdc7a7 100644
--- a/android-tools/static-binary/src/Makefile.64
+++ b/android-tools/static-binary/src/Makefile.64
@@ -2,24 +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
-
-LDFLAGS_LIBS := \
- -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 \
- $(TOOLCHAIN_LINARO_64)/aarch64-linux-android/lib64/libatomic.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 \
- -Lout/target/product/hikey/obj/lib out/target/product/hikey/obj/lib/crtbegin_static.o
-
-# out/target/product/hikey/obj/STATIC_LIBRARIES/libdl_intermediates/libdl.a \
- out/target/product/hikey/obj/STATIC_LIBRARIES/libcompiler_rt-extras_intermediates/libcompiler_rt-extras.a
+CC_linaro_64=$(TOOLCHAIN_LINARO_64)/bin/aarch64-linux-android-g++
CFLAGS_INCLUDES := \
-isystem $(BASE)/bionic/libc/arch-arm64/include \
@@ -31,20 +20,6 @@ CFLAGS_INCLUDES := \
-include $(BASE)/build/core/combo/include/arch/linux-arm64/AndroidConfig.h \
-I $(BASE)/build/core/combo/include/arch/linux-arm64/ \
-# -I external/libcxx/include \
- -I libnativehelper/include/nativehelper \
- -isystem system/core/include \
- -isystem system/media/audio/include \
- -isystem hardware/libhardware/include \
- -isystem hardware/libhardware_legacy/include \
- -isystem hardware/ril/include \
- -isystem libnativehelper/include \
- -isystem frameworks/native/include \
- -isystem frameworks/native/opengl/include \
- -isystem frameworks/av/include \
- -isystem frameworks/base/include \
- -isystem out/target/product/hikey/obj/include \
-
CFLAGS_OPTIONS_GOOD := \
-fno-strict-aliasing \
-fstack-protector \
@@ -67,6 +42,7 @@ CFLAGS_OPTIONS_GOOD := \
-std=c11 \
-O2
+# not really necessry but help on more check
CFLAGS_OPTIONS_EXTRA := \
-fno-exceptions \
-Wno-multichar \
@@ -81,7 +57,6 @@ CFLAGS_OPTIONS_EXTRA := \
-Werror=non-virtual-dtor \
-Werror=address \
-Werror=sequence-point \
- -DNDEBUG \
-g \
-Wstrict-aliasing=2 \
-fgcse-after-reload \
@@ -93,9 +68,6 @@ CFLAGS_OPTIONS_EXTRA := \
-Werror=int-to-pointer-cast \
-Werror=pointer-to-int-cast \
-CFLAGS_OPTIONS := $(CFLAGS_OPTIONS_GOOD) $(CFLAGS_OPTIONS_EXTRA)
-CFLAGS := $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS)
-
LDFLAGS_OPTIONS_GOOD := \
-Wl,-z,noexecstack \
-Wl,-z,relro \
@@ -109,20 +81,6 @@ LDFLAGS_OPTIONS_GOOD := \
-Wl,--allow-shlib-undefined \
-Wl,--no-undefined \
-LDFLAGS_OPTIONS_EXTRA := \
- -nostdlib \
- -Wl,--gc-sections \
- -Wl,--whole-archive \
- -Wl,--no-whole-archive \
-
-LDFLAGS_OPTIONS := $(LDFLAGS_OPTIONS_GOOD) $(LDFLAGS_OPTIONS_EXTRA)
-
-all: strcpy_test_linaro \
- strcpy_test_linaro_static \
- strcpy_test_google \
- strcpy_test_google_static \
- move
-
#############################################################################
############## meanings of GCC options ######################################
#############################################################################
@@ -167,55 +125,77 @@ 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.
# On other systems, this option has no effect.
+# -nostdlib
+# Do not use the standard system startup files or libraries when linking.
+# No startup files and only the libraries you specify are passed to the linker, and options specifying linkage of the system libraries,
+# such as "-static-libgcc" or "-shared-libgcc", are ignored.
+# The compiler may generate calls to "memcmp", "memset", "memcpy" and "memmove".
+# These entries are usually resolved by entries in libc.
+# These entry points should be supplied through some other mechanism when this option is specified.
+#
+# One of the standard libraries bypassed by -nostdlib and -nodefaultlibs is libgcc.a,
+# a library of internal subroutines which GCC uses to overcome shortcomings of particular machines, or special needs for some languages.
+# In most cases, you need libgcc.a even when you want to avoid other standard libraries.
+# In other words, when you specify -nostdlib or -nodefaultlibs you should usually specify -lgcc as well.
+# This ensures that you have no unresolved references to internal GCC library subroutines.
+# (An example of such an internal subroutine is __main, used to ensure C++ constructors are called.)
+
+# -pie
+# 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) \
- -static -Bstatic \
- $(CFLAGS_OPTIONS_EXTRA) $(LDFLAGS_OPTIONS_EXTRA) \
- -Wl,--start-group $(BASE)/development/ndk/platforms/android-21/arch-arm64/lib/libc.a \
- $(TOOLCHAIN_LINARO_64)/aarch64-linux-android/lib64/libatomic.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 \
- -L$(BASE)/out/target/product/hikey/obj/lib/crtbegin_static.o \
- $^ -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) \
- -static -Bstatic \
- $(CFLAGS_OPTIONS_EXTRA) $(LDFLAGS_OPTIONS_EXTRA) \
- -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 \
- -L$(BASE)/out/target/product/hikey/obj/lib/crtbegin_static.o \
- $^ -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/Makefile.64.good b/android-tools/static-binary/src/Makefile.64.good
deleted file mode 100644
index 1cdc7a7..0000000
--- a/android-tools/static-binary/src/Makefile.64.good
+++ /dev/null
@@ -1,201 +0,0 @@
-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-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-g++
-
-CFLAGS_INCLUDES := \
- -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_OPTIONS_GOOD := \
- -fno-strict-aliasing \
- -fstack-protector \
- -ffunction-sections \
- -fdata-sections \
- -funwind-tables \
- -Wa,--noexecstack \
- -Wformat \
- -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 \
- -std=c11 \
- -O2
-
-# not really necessry but help on more check
-CFLAGS_OPTIONS_EXTRA := \
- -fno-exceptions \
- -Wno-multichar \
- -DANDROID \
- -fmessage-length=0 \
- -W \
- -Wall \
- -Wno-unused \
- -Winit-self \
- -Wpointer-arith \
- -Werror=return-type \
- -Werror=non-virtual-dtor \
- -Werror=address \
- -Werror=sequence-point \
- -g \
- -Wstrict-aliasing=2 \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -DNDEBUG \
- -UDEBUG \
- -D_USING_LIBCXX \
- -Werror=int-to-pointer-cast \
- -Werror=pointer-to-int-cast \
-
-LDFLAGS_OPTIONS_GOOD := \
- -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 \
-
-#############################################################################
-############## meanings of GCC options ######################################
-#############################################################################
-# -I dir
-# Add the directory dir to the list of directories to be searched for header files.
-# Directories named by -I are searched before the standard system include directories.
-# If the directory dir is a standard system include directory, the option is ignored to ensure that the default search order for system directories and the special treatment of system headers are not defeated .
-# If dir begins with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.
-
-# -isystem dir
-# Search dir for header files, after all directories specified by -I but before the standard system directories.
-# Mark it as a system directory, so that it gets the same special treatment as is applied to the standard system directories.
-# If dir begins with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot.
-
-# -include file
-# Process file as if "#include "file"" appeared as the first line of the primary source file.
-# However, the first directory searched for file is the preprocessor's working directory instead of the directory containing the main source file.
-# If not found there, it is searched for in the remainder of the "#include "..."" search chain as normal.
-# If multiple -include options are given, the files are included in the order they appear on the command line.
-
-# -isysroot dir
-# This option is like the --sysroot option, but applies only to header files (except for Darwin targets, where it applies to both header files and libraries).
-# See the --sysroot option for more information
-
-# --sysroot=dir
-# Use dir as the logical root directory for headers and libraries.
-# For example, if the compiler normally searches for headers in /usr/include and libraries in /usr/lib,
-# it instead searches dir/usr/include and dir/usr/lib.
-# If you use both this option and the -isysroot option, then the --sysroot option applies to libraries, but the -isysroot option applies to header files.
-# The GNU linker (beginning with version 2.16) has the necessary support for this option.
-# If your linker does not support this option, the header file aspect of --sysroot still works, but the library aspect does not.
-
-# -mfloat-abi=name
-# Specifies which floating-point ABI to use. Permissible values are: soft, softfp and hard.
-# soft causes GCC to generate output containing library calls for floating-point operations.
-# softfp allows the generation of code using hardware floating-point instructions, but still uses the soft-float calling conventions.
-# hard allows generation of floating-point instructions and uses FPU-specific calling conventions.
-#
-# The default depends on the specific target configuration.
-# Note that the hard-float and soft-float ABIs are not link-compatible;
-# you must compile your entire program with the same ABI, and link with a compatible set of libraries.
-
-# -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.
-# On other systems, this option has no effect.
-
-# -nostdlib
-# Do not use the standard system startup files or libraries when linking.
-# No startup files and only the libraries you specify are passed to the linker, and options specifying linkage of the system libraries,
-# such as "-static-libgcc" or "-shared-libgcc", are ignored.
-# The compiler may generate calls to "memcmp", "memset", "memcpy" and "memmove".
-# These entries are usually resolved by entries in libc.
-# These entry points should be supplied through some other mechanism when this option is specified.
-#
-# One of the standard libraries bypassed by -nostdlib and -nodefaultlibs is libgcc.a,
-# a library of internal subroutines which GCC uses to overcome shortcomings of particular machines, or special needs for some languages.
-# In most cases, you need libgcc.a even when you want to avoid other standard libraries.
-# In other words, when you specify -nostdlib or -nodefaultlibs you should usually specify -lgcc as well.
-# This ensures that you have no unresolved references to internal GCC library subroutines.
-# (An example of such an internal subroutine is __main, used to ensure C++ constructors are called.)
-
-# -pie
-# 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 string_copy_linaro_wrapper.S string_copy_google_wrapper.S
-# 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
-
-strcpy_test_linaro_static: $(src)
- $(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) $(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) $(CFLAGS_OPTIONS_EXTRA) $(LDFLAGS_OPTIONS_GOOD) \
- --sysroot=$(SYSROOT) \
- -fPIE -pie \
- $^ -o $@
-
-strcpy_test_google: $(src)
- $(CC_google_64) $(CFLAGS_INCLUDES) $(CFLAGS_OPTIONS_GOOD) $(CFLAGS_OPTIONS_EXTRA) $(LDFLAGS_OPTIONS_GOOD) \
- --sysroot=$(SYSROOT) \
- -fPIE -pie \
- $^ -o $@
-
-move:
- @mkdir -p bin/
- @mv -v strcpy_test* bin/
-
-clean:
- rm -vf bin/strcpy_test*