Merge remote-tracking branch 'aosp/master' into aosp

This commit is contained in:
Colin Cross 2015-04-29 11:29:05 -07:00
commit c15e8fdb8d
230 changed files with 5564 additions and 3284 deletions

View File

@ -208,19 +208,17 @@ The tests are all built from the tests/ directory.
The host tests require that you have `lunch`ed either an x86 or x86_64 target.
$ mma
# 64-bit tests for 64-bit targets, 32-bit otherwise.
$ mm bionic-unit-tests-run-on-host
# Only exists for 64-bit targets.
$ mm bionic-unit-tests-run-on-host32
$ mm bionic-unit-tests-run-on-host64 # For 64-bit *targets* only.
### Against glibc
As a way to check that our tests do in fact test the correct behavior (and not
just the behavior we think is correct), it is possible to run the tests against
the host's glibc.
the host's glibc. The executables are already in your path.
$ mma
$ bionic-unit-tests-glibc32 # already in your path
$ bionic-unit-tests-glibc32
$ bionic-unit-tests-glibc64

View File

@ -121,8 +121,8 @@ void BM_pthread_mutex_lock_RECURSIVE::Run(int iters) {
StopBenchmarkTiming();
}
BENCHMARK_NO_ARG(BM_pthread_rw_lock_read);
void BM_pthread_rw_lock_read::Run(int iters) {
BENCHMARK_NO_ARG(BM_pthread_rwlock_read);
void BM_pthread_rwlock_read::Run(int iters) {
StopBenchmarkTiming();
pthread_rwlock_t lock;
pthread_rwlock_init(&lock, NULL);
@ -137,8 +137,8 @@ void BM_pthread_rw_lock_read::Run(int iters) {
pthread_rwlock_destroy(&lock);
}
BENCHMARK_NO_ARG(BM_pthread_rw_lock_write);
void BM_pthread_rw_lock_write::Run(int iters) {
BENCHMARK_NO_ARG(BM_pthread_rwlock_write);
void BM_pthread_rwlock_write::Run(int iters) {
StopBenchmarkTiming();
pthread_rwlock_t lock;
pthread_rwlock_init(&lock, NULL);

View File

@ -63,14 +63,22 @@ libc_common_src_files := \
stdio/sprintf.c \
stdio/stdio.c \
stdio/stdio_ext.cpp \
stdlib/atexit.c \
stdlib/exit.c \
# Fortify implementations of libc functions.
libc_common_src_files += \
bionic/__FD_chk.cpp \
bionic/__fgets_chk.cpp \
bionic/__memchr_chk.cpp \
bionic/__memmove_chk.cpp \
bionic/__memrchr_chk.cpp \
bionic/__poll_chk.cpp \
bionic/__pread64_chk.cpp \
bionic/__pread_chk.cpp \
bionic/__read_chk.cpp \
bionic/__readlink_chk.cpp \
bionic/__readlinkat_chk.cpp \
bionic/__recvfrom_chk.cpp \
bionic/__stpcpy_chk.cpp \
bionic/__stpncpy_chk.cpp \
@ -104,6 +112,7 @@ libc_bionic_ndk_src_files := \
bionic/clock_getcpuclockid.cpp \
bionic/clock_nanosleep.cpp \
bionic/clone.cpp \
bionic/close.cpp \
bionic/__cmsg_nxthdr.cpp \
bionic/connect.cpp \
bionic/ctype.cpp \
@ -476,11 +485,9 @@ libc_upstream_openbsd_ndk_src_files := \
upstream-openbsd/lib/libc/stdio/wprintf.c \
upstream-openbsd/lib/libc/stdio/wscanf.c \
upstream-openbsd/lib/libc/stdio/wsetup.c \
upstream-openbsd/lib/libc/stdlib/atexit.c \
upstream-openbsd/lib/libc/stdlib/atoi.c \
upstream-openbsd/lib/libc/stdlib/atol.c \
upstream-openbsd/lib/libc/stdlib/atoll.c \
upstream-openbsd/lib/libc/stdlib/exit.c \
upstream-openbsd/lib/libc/stdlib/getenv.c \
upstream-openbsd/lib/libc/stdlib/insque.c \
upstream-openbsd/lib/libc/stdlib/lsearch.c \
@ -521,7 +528,7 @@ libc_pthread_src_files := \
bionic/pthread_getcpuclockid.cpp \
bionic/pthread_getschedparam.cpp \
bionic/pthread_gettid_np.cpp \
bionic/pthread_internals.cpp \
bionic/pthread_internal.cpp \
bionic/pthread_join.cpp \
bionic/pthread_key.cpp \
bionic/pthread_kill.cpp \
@ -533,6 +540,9 @@ libc_pthread_src_files := \
bionic/pthread_setschedparam.cpp \
bionic/pthread_sigmask.cpp \
libc_thread_atexit_impl_src_files := \
bionic/__cxa_thread_atexit_impl.cpp \
libc_arch_static_src_files := \
bionic/dl_iterate_phdr_static.cpp \
@ -817,12 +827,7 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libc_upstream_openbsd_ndk_src_files)
ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
# Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
LOCAL_CLANG := false
else
LOCAL_CLANG := $(use_clang)
endif
LOCAL_CLANG := $(use_clang)
LOCAL_CFLAGS := \
$(libc_common_cflags) \
@ -860,12 +865,7 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libc_upstream_openbsd_src_files)
ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
# Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
LOCAL_CLANG := false
else
LOCAL_CLANG := $(use_clang)
endif
LOCAL_CLANG := $(use_clang)
LOCAL_CFLAGS := \
$(libc_common_cflags) \
@ -905,12 +905,7 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES_32 := $(libc_upstream_openbsd_gdtoa_src_files_32)
LOCAL_SRC_FILES_64 := $(libc_upstream_openbsd_gdtoa_src_files_64)
ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
# Clang has wrong long double size or LDBL_MANT_DIG, http://b/17163651.
LOCAL_CLANG := false
else
LOCAL_CLANG := $(use_clang)
endif
LOCAL_CLANG := $(use_clang)
LOCAL_CFLAGS := \
$(libc_common_cflags) \
@ -946,9 +941,6 @@ LOCAL_SRC_FILES := $(libc_bionic_src_files)
LOCAL_CFLAGS := $(libc_common_cflags) \
-Wframe-larger-than=2048 \
# ssse3-strcmp-slm.S does not compile with Clang.
LOCAL_CLANG_ASFLAGS_x86_64 += -no-integrated-as
# memcpy.S, memchr.S, etc. do not compile with Clang.
LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
@ -980,9 +972,6 @@ LOCAL_SRC_FILES := $(libc_bionic_ndk_src_files)
LOCAL_CFLAGS := $(libc_common_cflags) \
-Wframe-larger-than=2048 \
# ssse3-strcmp-slm.S does not compile with Clang.
LOCAL_CLANG_ASFLAGS_x86_64 += -no-integrated-as
# memcpy.S, memchr.S, etc. do not compile with Clang.
LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
@ -1002,6 +991,24 @@ $(eval $(call patch-up-arch-specific-flags,LOCAL_CFLAGS,libc_common_cflags))
$(eval $(call patch-up-arch-specific-flags,LOCAL_SRC_FILES,libc_bionic_src_files))
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libc_thread_atexit_impl_src_files)
LOCAL_CFLAGS := $(libc_common_cflags) -Wframe-larger-than=2048
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags) -Wold-style-cast
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_MODULE := libc_thread_atexit_impl
# TODO: Clang tries to use __tls_get_addr which is not supported yet
# remove after it is implemented.
LOCAL_CLANG := false
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
LOCAL_ADDRESS_SANITIZER := false
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
include $(BUILD_STATIC_LIBRARY)
# ========================================================
# libc_pthread.a - pthreads parts that previously lived in
@ -1017,9 +1024,6 @@ LOCAL_SRC_FILES := $(libc_pthread_src_files)
LOCAL_CFLAGS := $(libc_common_cflags) \
-Wframe-larger-than=2048 \
# ssse3-strcmp-slm.S does not compile with Clang.
LOCAL_CLANG_ASFLAGS_x86_64 += -no-integrated-as
# memcpy.S, memchr.S, etc. do not compile with Clang.
LOCAL_CLANG_ASFLAGS_arm += -no-integrated-as
LOCAL_CLANG_ASFLAGS_arm64 += -no-integrated-as
@ -1206,14 +1210,11 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \
libc_pthread \
libc_stack_protector \
libc_syscalls \
libc_thread_atexit_impl \
libc_tzcode \
LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi
ifneq ($(MALLOC_IMPL),dlmalloc)
LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
endif
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
@ -1306,6 +1307,11 @@ LOCAL_MODULE := libc
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
ifneq ($(MALLOC_IMPL),dlmalloc)
LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
endif
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
LOCAL_ADDRESS_SANITIZER := false
@ -1325,25 +1331,30 @@ LOCAL_CFLAGS := $(libc_common_cflags)
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags)
# TODO: This is to work around b/19059885. Remove after root cause is fixed
LOCAL_LDFLAGS_arm := -Wl,--hash-style=sysv
LOCAL_C_INCLUDES := $(libc_common_c_includes)
LOCAL_SRC_FILES := \
arch-common/bionic/crtbegin_so.c \
arch-common/bionic/crtbrand.S \
$(libc_arch_dynamic_src_files) \
bionic/malloc_debug_common.cpp \
bionic/libc_init_dynamic.cpp \
bionic/NetdClient.cpp \
arch-common/bionic/crtend_so.S \
LOCAL_MODULE := libc
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_REQUIRED_MODULES := tzdata
LOCAL_ADDITIONAL_DEPENDENCIES := \
$(libc_common_additional_dependencies) \
$(LOCAL_PATH)/version_script.txt \
# Leave the symbols in the shared library so that stack unwinders can produce
# meaningful name resolution.
LOCAL_STRIP_MODULE := keep_symbols
# Do not pack libc.so relocations; see http://b/20645321 for details.
LOCAL_PACK_MODULE_RELOCATIONS := false
# WARNING: The only library libc.so should depend on is libdl.so! If you add other libraries,
# make sure to add -Wl,--exclude-libs=libgcc.a to the LOCAL_LDFLAGS for those libraries. This
# ensures that symbols that are pulled into those new libraries from libgcc.a are not declared
@ -1354,25 +1365,37 @@ LOCAL_STRIP_MODULE := keep_symbols
LOCAL_SHARED_LIBRARIES := libdl
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
ifneq ($(MALLOC_IMPL),dlmalloc)
LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc
endif
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
# Don't re-export new/delete and friends, even if the compiler really wants to.
LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/version_script.txt
# 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_64 := -Wl,--exclude-libs,libgcc.a
# TODO: disabled for http://b/20065774.
#LOCAL_LDFLAGS_64 := -Wl,--exclude-libs,libgcc.a
# TODO: This is to work around b/19059885. Remove after root cause is fixed
LOCAL_LDFLAGS_arm := -Wl,--hash-style=sysv
$(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))
LOCAL_NO_CRT := true
LOCAL_ASFLAGS += $(libc_crt_target_cflags)
# special for arm
LOCAL_NO_CRT_arm := true
LOCAL_CFLAGS_arm += -DCRT_LEGACY_WORKAROUND
LOCAL_ASFLAGS_arm += $(libc_crt_target_cflags)
LOCAL_SRC_FILES_arm += \
arch-common/bionic/crtbegin_so.c \
arch-common/bionic/crtbrand.S \
arch-arm/bionic/atexit_legacy.c \
arch-common/bionic/crtend_so.S
arch-arm/bionic/atexit_legacy.c
LOCAL_ADDRESS_SANITIZER := false
LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
@ -1409,7 +1432,9 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libc_malloc_debug_leak
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_ADDITIONAL_DEPENDENCIES := \
$(libc_common_additional_dependencies) \
$(LOCAL_PATH)/version_script.txt \
LOCAL_SHARED_LIBRARIES := libc libdl
LOCAL_CXX_STL := none
@ -1420,6 +1445,9 @@ LOCAL_STATIC_LIBRARIES_arm := libunwind_llvm
LOCAL_STATIC_LIBRARIES += libc++abi
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
# Don't re-export new/delete and friends, even if the compiler really wants to.
LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/version_script.txt
# Don't install on release build
LOCAL_MODULE_TAGS := eng debug
LOCAL_ADDRESS_SANITIZER := false
@ -1449,12 +1477,17 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libc_malloc_debug_qemu
LOCAL_CLANG := $(use_clang)
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
LOCAL_ADDITIONAL_DEPENDENCIES := \
$(libc_common_additional_dependencies) \
$(LOCAL_PATH)/version_script.txt \
LOCAL_SHARED_LIBRARIES := libc libdl
LOCAL_CXX_STL := none
LOCAL_SYSTEM_SHARED_LIBRARIES :=
# Don't re-export new/delete and friends, even if the compiler really wants to.
LOCAL_LDFLAGS := -Wl,--version-script,$(LOCAL_PATH)/version_script.txt
# Don't install on release build
LOCAL_MODULE_TAGS := eng debug
LOCAL_ADDRESS_SANITIZER := false
@ -1480,7 +1513,7 @@ LOCAL_CFLAGS := $(libc_common_cflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags)
# TODO: This is to work around b/19059885. Remove after root cause is fixed
LOCAL_LDFLAGS_arm := -Wl,--hash-style=both
LOCAL_LDFLAGS_arm := -Wl,--hash-style=sysv
LOCAL_SRC_FILES := $(libstdcxx_common_src_files)
LOCAL_MODULE:= libstdc++

View File

@ -95,7 +95,7 @@ ssize_t pread64(int, void*, size_t, off64_t) arm,mips,x86
ssize_t pread64|pread(int, void*, size_t, off_t) arm64,mips64,x86_64
ssize_t pwrite64(int, void*, size_t, off64_t) arm,mips,x86
ssize_t pwrite64|pwrite(int, void*, size_t, off_t) arm64,mips64,x86_64
int close(int) all
int ___close:close(int) all
pid_t __getpid:getpid() all
int munmap(void*, size_t) all
void* mremap(void*, size_t, size_t, unsigned long) all
@ -174,9 +174,9 @@ int __fadvise64:fadvise64_64(int, off64_t, off64_t, int) x86
int __fadvise64:fadvise64(int, off64_t, off64_t, int) arm64,mips,mips64,x86_64
int __fstatfs64:fstatfs64(int, size_t, struct statfs*) arm,mips,x86
int fstatfs64|fstatfs:fstatfs(int, struct statfs*) arm64,mips64,x86_64
int __fstatfs:fstatfs(int, struct statfs*) arm64,mips64,x86_64
int __statfs64:statfs64(const char*, size_t, struct statfs*) arm,mips,x86
int statfs64|statfs:statfs(const char*, struct statfs*) arm64,mips64,x86_64
int __statfs:statfs(const char*, struct statfs*) arm64,mips64,x86_64
int fstat64|fstat:fstat64(int, struct stat*) arm,mips,x86
int fstat64|fstat:fstat(int, struct stat*) arm64,x86_64

View File

@ -39,6 +39,7 @@ libc_bionic_src_files_arm += \
arch-arm/bionic/__bionic_clone.S \
arch-arm/bionic/_exit_with_stack_teardown.S \
arch-arm/bionic/libgcc_compat.c \
arch-arm/bionic/libgcc_protect_unwind.c \
arch-arm/bionic/__restore.S \
arch-arm/bionic/setjmp.S \
arch-arm/bionic/syscall.S \

View File

@ -0,0 +1,93 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// TODO: This file should go away once unwinder migration to libc++.so is complete.
extern char _Unwind_Backtrace __attribute((visibility("protected")));
extern char __gnu_Unwind_Find_exidx __attribute((visibility("protected")));
extern char __gnu_Unwind_Restore_VFP_D __attribute((visibility("protected")));
extern char __gnu_Unwind_Restore_VFP __attribute((visibility("protected")));
extern char __gnu_Unwind_Restore_VFP_D_16_to_31 __attribute((visibility("protected")));
extern char __gnu_Unwind_Restore_WMMXD __attribute((visibility("protected")));
extern char __gnu_Unwind_Restore_WMMXC __attribute((visibility("protected")));
extern char _Unwind_GetCFA __attribute((visibility("protected")));
extern char __gnu_Unwind_RaiseException __attribute((visibility("protected")));
extern char __gnu_Unwind_ForcedUnwind __attribute((visibility("protected")));
extern char __gnu_Unwind_Resume __attribute((visibility("protected")));
extern char __gnu_Unwind_Resume_or_Rethrow __attribute((visibility("protected")));
extern char _Unwind_Complete __attribute((visibility("protected")));
extern char _Unwind_DeleteException __attribute((visibility("protected")));
extern char _Unwind_VRS_Get __attribute((visibility("protected")));
extern char _Unwind_VRS_Set __attribute((visibility("protected")));
extern char __gnu_Unwind_Backtrace __attribute((visibility("protected")));
extern char _Unwind_VRS_Pop __attribute((visibility("protected")));
extern char __gnu_Unwind_Save_VFP_D __attribute((visibility("protected")));
extern char __gnu_Unwind_Save_VFP __attribute((visibility("protected")));
extern char __gnu_Unwind_Save_VFP_D_16_to_31 __attribute((visibility("protected")));
extern char __gnu_Unwind_Save_WMMXD __attribute((visibility("protected")));
extern char __gnu_Unwind_Save_WMMXC __attribute((visibility("protected")));
extern char ___Unwind_RaiseException __attribute((visibility("protected")));
extern char _Unwind_RaiseException __attribute((visibility("protected")));
extern char ___Unwind_Resume __attribute((visibility("protected")));
extern char _Unwind_Resume __attribute((visibility("protected")));
extern char ___Unwind_Resume_or_Rethrow __attribute((visibility("protected")));
extern char _Unwind_Resume_or_Rethrow __attribute((visibility("protected")));
extern char ___Unwind_ForcedUnwind __attribute((visibility("protected")));
extern char _Unwind_ForcedUnwind __attribute((visibility("protected")));
extern char ___Unwind_Backtrace __attribute((visibility("protected")));
extern char _Unwind_GetRegionStart __attribute((visibility("protected")));
extern char _Unwind_GetLanguageSpecificData __attribute((visibility("protected")));
extern char _Unwind_GetDataRelBase __attribute((visibility("protected")));
extern char _Unwind_GetTextRelBase __attribute((visibility("protected")));
void* __bionic_libgcc_unwind_symbols[] = {
&_Unwind_Backtrace,
&__gnu_Unwind_Find_exidx,
&__gnu_Unwind_Restore_VFP_D,
&__gnu_Unwind_Restore_VFP,
&__gnu_Unwind_Restore_VFP_D_16_to_31,
&__gnu_Unwind_Restore_WMMXD,
&__gnu_Unwind_Restore_WMMXC,
&_Unwind_GetCFA,
&__gnu_Unwind_RaiseException,
&__gnu_Unwind_ForcedUnwind,
&__gnu_Unwind_Resume,
&__gnu_Unwind_Resume_or_Rethrow,
&_Unwind_Complete,
&_Unwind_DeleteException,
&_Unwind_VRS_Get,
&_Unwind_VRS_Set,
&__gnu_Unwind_Backtrace,
&_Unwind_VRS_Pop,
&__gnu_Unwind_Save_VFP_D,
&__gnu_Unwind_Save_VFP,
&__gnu_Unwind_Save_VFP_D_16_to_31,
&__gnu_Unwind_Save_WMMXD,
&__gnu_Unwind_Save_WMMXC,
&___Unwind_RaiseException,
&_Unwind_RaiseException,
&___Unwind_Resume,
&_Unwind_Resume,
&___Unwind_Resume_or_Rethrow,
&_Unwind_Resume_or_Rethrow,
&___Unwind_ForcedUnwind,
&_Unwind_ForcedUnwind,
&___Unwind_Backtrace,
&_Unwind_GetRegionStart,
&_Unwind_GetLanguageSpecificData,
&_Unwind_GetDataRelBase,
&_Unwind_GetTextRelBase,
};

View File

@ -169,7 +169,5 @@ ENTRY(siglongjmp)
bx lr
END(siglongjmp)
.globl longjmp
.equ longjmp, siglongjmp
.globl _longjmp
.equ _longjmp, siglongjmp
ALIAS_SYMBOL(longjmp, siglongjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)

View File

@ -1,5 +1,4 @@
libc_bionic_src_files_arm += \
arch-arm/generic/bionic/memcmp.S \
arch-arm/cortex-a15/bionic/memcpy.S \
arch-arm/cortex-a15/bionic/memset.S \
arch-arm/cortex-a15/bionic/stpcpy.S \
@ -10,5 +9,8 @@ libc_bionic_src_files_arm += \
arch-arm/cortex-a15/bionic/__strcpy_chk.S \
arch-arm/cortex-a15/bionic/strlen.S \
libc_openbsd_src_files_arm += \
upstream-openbsd/lib/libc/string/memmove.c \
libc_bionic_src_files_arm += \
arch-arm/generic/bionic/memcmp.S \
libc_bionic_src_files_arm += \
arch-arm/denver/bionic/memmove.S \

View File

@ -44,7 +44,7 @@ ENTRY_PRIVATE(MEMCPY_BASE)
/* check if buffers are aligned. If so, run arm-only version */
eor r3, r0, r1
ands r3, r3, #0x3
beq __memcpy_base_aligned
beq MEMCPY_BASE_ALIGNED
/* Check the upper size limit for Neon unaligned memory access in memcpy */
cmp r2, #224

View File

@ -1,5 +1,4 @@
libc_bionic_src_files_arm += \
arch-arm/generic/bionic/memcmp.S \
arch-arm/cortex-a9/bionic/memcpy.S \
arch-arm/cortex-a9/bionic/memset.S \
arch-arm/cortex-a9/bionic/stpcpy.S \
@ -10,5 +9,8 @@ libc_bionic_src_files_arm += \
arch-arm/cortex-a9/bionic/__strcpy_chk.S \
arch-arm/cortex-a9/bionic/strlen.S \
libc_openbsd_src_files_arm += \
upstream-openbsd/lib/libc/string/memmove.c \
libc_bionic_src_files_arm += \
arch-arm/generic/bionic/memcmp.S \
libc_bionic_src_files_arm += \
arch-arm/denver/bionic/memmove.S \

View File

@ -1,5 +1,4 @@
libc_bionic_src_files_arm += \
arch-arm/generic/bionic/memcmp.S \
arch-arm/krait/bionic/memcpy.S \
arch-arm/krait/bionic/memset.S \
arch-arm/krait/bionic/strcmp.S \
@ -13,5 +12,8 @@ libc_bionic_src_files_arm += \
arch-arm/cortex-a15/bionic/strcpy.S \
arch-arm/cortex-a15/bionic/strlen.S \
libc_openbsd_src_files_arm += \
upstream-openbsd/lib/libc/string/memmove.c \
libc_bionic_src_files_arm += \
arch-arm/generic/bionic/memcmp.S \
libc_bionic_src_files_arm += \
arch-arm/denver/bionic/memmove.S \

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(close)
ENTRY(___close)
mov ip, r7
ldr r7, =__NR_close
swi #0
@ -11,4 +11,5 @@ ENTRY(close)
bxls lr
neg r0, r0
b __set_errno_internal
END(close)
END(___close)
.hidden ___close

View File

@ -13,5 +13,4 @@ ENTRY(_exit)
b __set_errno_internal
END(_exit)
.globl _Exit
.equ _Exit, _exit
ALIAS_SYMBOL(_Exit, _exit)

View File

@ -13,5 +13,4 @@ ENTRY(fstat64)
b __set_errno_internal
END(fstat64)
.globl fstat
.equ fstat, fstat64
ALIAS_SYMBOL(fstat, fstat64)

View File

@ -13,5 +13,4 @@ ENTRY(fstatat64)
b __set_errno_internal
END(fstatat64)
.globl fstatat
.equ fstatat, fstatat64
ALIAS_SYMBOL(fstatat, fstatat64)

View File

@ -40,6 +40,8 @@ libc_bionic_src_files_arm64 += \
arch-arm64/bionic/syscall.S \
arch-arm64/bionic/vfork.S \
# Work around for http://b/20065774.
libc_bionic_src_files_arm64 += arch-arm64/bionic/libgcc_compat.c
libc_crt_target_cflags_arm64 := \
-I$(LOCAL_PATH)/arch-arm64/include

View File

@ -67,3 +67,4 @@ __asm__ (
#include "../../arch-common/bionic/__dso_handle.h"
#include "../../arch-common/bionic/atexit.h"
#include "../../arch-common/bionic/pthread_atfork.h"

View File

@ -0,0 +1,15 @@
/* STOPSHIP: remove this once the flounder blobs have been rebuilt (http://b/20065774). */
#if !defined(__clang__)
extern void __clear_cache(char*, char*);
extern char _Unwind_Backtrace;
extern char _Unwind_GetIP;
void* __bionic_libgcc_compat_symbols[] = {
&__clear_cache,
&_Unwind_Backtrace,
&_Unwind_GetIP,
};
#endif

View File

@ -146,7 +146,5 @@ ENTRY(siglongjmp)
ret
END(siglongjmp)
.globl longjmp
.equ longjmp, siglongjmp
.globl _longjmp
.equ _longjmp, siglongjmp
ALIAS_SYMBOL(longjmp, siglongjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(close)
ENTRY(___close)
mov x8, __NR_close
svc #0
@ -11,4 +11,5 @@ ENTRY(close)
b.hi __set_errno_internal
ret
END(close)
END(___close)
.hidden ___close

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(fstatfs64)
ENTRY(__fstatfs)
mov x8, __NR_fstatfs
svc #0
@ -11,7 +11,5 @@ ENTRY(fstatfs64)
b.hi __set_errno_internal
ret
END(fstatfs64)
.globl fstatfs
.equ fstatfs, fstatfs64
END(__fstatfs)
.hidden __fstatfs

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(statfs64)
ENTRY(__statfs)
mov x8, __NR_statfs
svc #0
@ -11,7 +11,5 @@ ENTRY(statfs64)
b.hi __set_errno_internal
ret
END(statfs64)
.globl statfs
.equ statfs, statfs64
END(__statfs)
.hidden __statfs

View File

@ -13,5 +13,4 @@ ENTRY(_exit)
ret
END(_exit)
.globl _Exit
.equ _Exit, _exit
ALIAS_SYMBOL(_Exit, _exit)

View File

@ -13,5 +13,4 @@ ENTRY(fallocate)
ret
END(fallocate)
.globl fallocate64
.equ fallocate64, fallocate
ALIAS_SYMBOL(fallocate64, fallocate)

View File

@ -13,5 +13,4 @@ ENTRY(fstat64)
ret
END(fstat64)
.globl fstat
.equ fstat, fstat64
ALIAS_SYMBOL(fstat, fstat64)

View File

@ -13,5 +13,4 @@ ENTRY(fstatat64)
ret
END(fstatat64)
.globl fstatat
.equ fstatat, fstatat64
ALIAS_SYMBOL(fstatat, fstatat64)

View File

@ -13,5 +13,4 @@ ENTRY(ftruncate)
ret
END(ftruncate)
.globl ftruncate64
.equ ftruncate64, ftruncate
ALIAS_SYMBOL(ftruncate64, ftruncate)

View File

@ -13,5 +13,4 @@ ENTRY(getrlimit)
ret
END(getrlimit)
.globl getrlimit64
.equ getrlimit64, getrlimit
ALIAS_SYMBOL(getrlimit64, getrlimit)

View File

@ -13,5 +13,4 @@ ENTRY(lseek)
ret
END(lseek)
.globl lseek64
.equ lseek64, lseek
ALIAS_SYMBOL(lseek64, lseek)

View File

@ -13,5 +13,4 @@ ENTRY(mmap)
ret
END(mmap)
.globl mmap64
.equ mmap64, mmap
ALIAS_SYMBOL(mmap64, mmap)

View File

@ -13,5 +13,4 @@ ENTRY(pread64)
ret
END(pread64)
.globl pread
.equ pread, pread64
ALIAS_SYMBOL(pread, pread64)

View File

@ -13,5 +13,4 @@ ENTRY(prlimit64)
ret
END(prlimit64)
.globl prlimit
.equ prlimit, prlimit64
ALIAS_SYMBOL(prlimit, prlimit64)

View File

@ -13,5 +13,4 @@ ENTRY(pwrite64)
ret
END(pwrite64)
.globl pwrite
.equ pwrite, pwrite64
ALIAS_SYMBOL(pwrite, pwrite64)

View File

@ -13,5 +13,4 @@ ENTRY(sendfile)
ret
END(sendfile)
.globl sendfile64
.equ sendfile64, sendfile
ALIAS_SYMBOL(sendfile64, sendfile)

View File

@ -13,5 +13,4 @@ ENTRY(setrlimit)
ret
END(setrlimit)
.globl setrlimit64
.equ setrlimit64, setrlimit
ALIAS_SYMBOL(setrlimit64, setrlimit)

View File

@ -13,5 +13,4 @@ ENTRY(truncate)
ret
END(truncate)
.globl truncate64
.equ truncate64, truncate
ALIAS_SYMBOL(truncate64, truncate)

View File

@ -59,6 +59,7 @@ void _start() {
#include "__dso_handle.h"
#include "atexit.h"
#include "pthread_atfork.h"
#ifdef __i386__
# include "../../arch-x86/bionic/__stack_chk_fail_local.h"
#endif

View File

@ -56,6 +56,7 @@ void __on_dlclose() {
# include "__dso_handle_so.h"
# include "atexit.h"
#endif
#include "pthread_atfork.h"
#ifdef __i386__
# include "../../arch-x86/bionic/__stack_chk_fail_local.h"
#endif

View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
extern void* __dso_handle;
extern int __register_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void), void* dso);
#ifndef _LIBC
// Libc used to export this in previous versions, therefore it needs
// to remain global for binary compatibility.
__attribute__ ((visibility ("hidden")))
#endif
int pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void)) {
return __register_atfork(prepare, parent, child, &__dso_handle);
}

View File

@ -92,3 +92,4 @@ __asm__ (
#include "../../arch-common/bionic/__dso_handle.h"
#include "../../arch-common/bionic/atexit.h"
#include "../../arch-common/bionic/pthread_atfork.h"

View File

@ -352,12 +352,5 @@ longjmp_botch:
jal abort
END(siglongjmp)
.globl longjmp
.type longjmp, @function
.equ longjmp, siglongjmp # alias for siglongjmp
.globl _longjmp
.type _longjmp, @function
.equ _longjmp, siglongjmp # alias for siglongjmp
ALIAS_SYMBOL(longjmp, siglongjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)

View File

@ -67,86 +67,6 @@
#define DBG
#endif
/*
* void _memset16(uint16_t* dst, uint16_t value, size_t size);
*/
LEAF(_memset16,0)
.set noreorder
DBG /* Check parameters */
DBG andi t0,a0,1 # a0 must be halfword aligned
DBG tne t0,zero
DBG andi t2,a2,1 # a2 must be even
DBG tne t2,zero
#ifdef FIXARGS
# ensure count is even
#if (__mips==32) && (__mips_isa_rev>=2)
ins a2,zero,0,1
#else
ori a2,1
xori a2,1
#endif
#endif
#if (__mips==32) && (__mips_isa_rev>=2)
ins a1,a1,16,16
#else
andi a1,0xffff
sll t3,a1,16
or a1,t3
#endif
beqz a2,.Ldone
andi t1,a0,2
beqz t1,.Lalignok
addu t0,a0,a2 # t0 is the "past the end" address
sh a1,0(a0) # store one halfword to get aligned
addu a0,2
subu a2,2
.Lalignok:
slti t1,a2,4 # .Laligned for 4 or more bytes
beqz t1,.Laligned
sne t1,a2,2 # one more halfword?
bnez t1,.Ldone
nop
sh a1,0(a0)
.Ldone:
j ra
nop
.set reorder
END(_memset16)
/*
* void _memset32(uint32_t* dst, uint32_t value, size_t size);
*/
LEAF(_memset32,0)
.set noreorder
DBG /* Check parameters */
DBG andi t0,a0,3 # a0 must be word aligned
DBG tne t0,zero
DBG andi t2,a2,3 # a2 must be a multiple of 4 bytes
DBG tne t2,zero
#ifdef FIXARGS
# ensure count is a multiple of 4
#if (__mips==32) && (__mips_isa_rev>=2)
ins $a2,$0,0,2
#else
ori a2,3
xori a2,3
#endif
#endif
bnez a2,.Laligned # any work to do?
addu t0,a0,a2 # t0 is the "past the end" address
j ra
nop
.set reorder
END(_memset32)
LEAF(memset,0)
.set noreorder

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(close)
ENTRY(___close)
.set noreorder
.cpload t9
li v0, __NR_close
@ -16,4 +16,5 @@ ENTRY(close)
j t9
nop
.set reorder
END(close)
END(___close)
.hidden ___close

View File

@ -18,5 +18,4 @@ ENTRY(_exit)
.set reorder
END(_exit)
.globl _Exit
.equ _Exit, _exit
ALIAS_SYMBOL(_Exit, _exit)

View File

@ -18,5 +18,4 @@ ENTRY(fstat64)
.set reorder
END(fstat64)
.globl fstat
.equ fstat, fstat64
ALIAS_SYMBOL(fstat, fstat64)

View File

@ -18,5 +18,4 @@ ENTRY(fstatat64)
.set reorder
END(fstatat64)
.globl fstatat
.equ fstatat, fstatat64
ALIAS_SYMBOL(fstatat, fstatat64)

View File

@ -92,3 +92,4 @@ __asm__ (
#include "../../arch-common/bionic/__dso_handle.h"
#include "../../arch-common/bionic/atexit.h"
#include "../../arch-common/bionic/pthread_atfork.h"

View File

@ -67,86 +67,6 @@
#define DBG
#endif
/*
* void _memset16(uint16_t* dst, uint16_t value, size_t size);
*/
LEAF(_memset16,0)
.set noreorder
DBG /* Check parameters */
DBG andi t0,a0,1 # a0 must be halfword aligned
DBG tne t0,zero
DBG andi t2,a2,1 # a2 must be even
DBG tne t2,zero
#ifdef FIXARGS
# ensure count is even
#if (__mips==32) && (__mips_isa_rev>=2)
ins a2,zero,0,1
#else
ori a2,1
xori a2,1
#endif
#endif
#if (__mips==32) && (__mips_isa_rev>=2)
ins a1,a1,16,16
#else
andi a1,0xffff
sll t3,a1,16
or a1,t3
#endif
beqz a2,.Ldone
andi t1,a0,2
beqz t1,.Lalignok
addu t0,a0,a2 # t0 is the "past the end" address
sh a1,0(a0) # store one halfword to get aligned
addu a0,2
subu a2,2
.Lalignok:
slti t1,a2,4 # .Laligned for 4 or more bytes
beqz t1,.Laligned
sne t1,a2,2 # one more halfword?
bnez t1,.Ldone
nop
sh a1,0(a0)
.Ldone:
j ra
nop
.set reorder
END(_memset16)
/*
* void _memset32(uint32_t* dst, uint32_t value, size_t size);
*/
LEAF(_memset32,0)
.set noreorder
DBG /* Check parameters */
DBG andi t0,a0,3 # a0 must be word aligned
DBG tne t0,zero
DBG andi t2,a2,3 # a2 must be a multiple of 4 bytes
DBG tne t2,zero
#ifdef FIXARGS
# ensure count is a multiple of 4
#if (__mips==32) && (__mips_isa_rev>=2)
ins $a2,$0,0,2
#else
ori a2,3
xori a2,3
#endif
#endif
bnez a2,.Laligned # any work to do?
addu t0,a0,a2 # t0 is the "past the end" address
j ra
nop
.set reorder
END(_memset32)
LEAF(memset,0)
.set noreorder

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(close)
ENTRY(___close)
.set push
.set noreorder
li v0, __NR_close
@ -22,4 +22,5 @@ ENTRY(close)
j t9
move ra, t0
.set pop
END(close)
END(___close)
.hidden ___close

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(fstatfs64)
ENTRY(__fstatfs)
.set push
.set noreorder
li v0, __NR_fstatfs
@ -22,7 +22,5 @@ ENTRY(fstatfs64)
j t9
move ra, t0
.set pop
END(fstatfs64)
.globl fstatfs
.equ fstatfs, fstatfs64
END(__fstatfs)
.hidden __fstatfs

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(statfs64)
ENTRY(__statfs)
.set push
.set noreorder
li v0, __NR_statfs
@ -22,7 +22,5 @@ ENTRY(statfs64)
j t9
move ra, t0
.set pop
END(statfs64)
.globl statfs
.equ statfs, statfs64
END(__statfs)
.hidden __statfs

View File

@ -24,5 +24,4 @@ ENTRY(_exit)
.set pop
END(_exit)
.globl _Exit
.equ _Exit, _exit
ALIAS_SYMBOL(_Exit, _exit)

View File

@ -24,5 +24,4 @@ ENTRY(fallocate)
.set pop
END(fallocate)
.globl fallocate64
.equ fallocate64, fallocate
ALIAS_SYMBOL(fallocate64, fallocate)

View File

@ -24,5 +24,4 @@ ENTRY(ftruncate)
.set pop
END(ftruncate)
.globl ftruncate64
.equ ftruncate64, ftruncate
ALIAS_SYMBOL(ftruncate64, ftruncate)

View File

@ -24,5 +24,4 @@ ENTRY(getrlimit)
.set pop
END(getrlimit)
.globl getrlimit64
.equ getrlimit64, getrlimit
ALIAS_SYMBOL(getrlimit64, getrlimit)

View File

@ -24,5 +24,4 @@ ENTRY(lseek)
.set pop
END(lseek)
.globl lseek64
.equ lseek64, lseek
ALIAS_SYMBOL(lseek64, lseek)

View File

@ -24,5 +24,4 @@ ENTRY(mmap)
.set pop
END(mmap)
.globl mmap64
.equ mmap64, mmap
ALIAS_SYMBOL(mmap64, mmap)

View File

@ -24,5 +24,4 @@ ENTRY(pread64)
.set pop
END(pread64)
.globl pread
.equ pread, pread64
ALIAS_SYMBOL(pread, pread64)

View File

@ -24,5 +24,4 @@ ENTRY(prlimit64)
.set pop
END(prlimit64)
.globl prlimit
.equ prlimit, prlimit64
ALIAS_SYMBOL(prlimit, prlimit64)

View File

@ -24,5 +24,4 @@ ENTRY(pwrite64)
.set pop
END(pwrite64)
.globl pwrite
.equ pwrite, pwrite64
ALIAS_SYMBOL(pwrite, pwrite64)

View File

@ -24,5 +24,4 @@ ENTRY(sendfile)
.set pop
END(sendfile)
.globl sendfile64
.equ sendfile64, sendfile
ALIAS_SYMBOL(sendfile64, sendfile)

View File

@ -24,5 +24,4 @@ ENTRY(setrlimit)
.set pop
END(setrlimit)
.globl setrlimit64
.equ setrlimit64, setrlimit
ALIAS_SYMBOL(setrlimit64, setrlimit)

View File

@ -24,5 +24,4 @@ ENTRY(truncate)
.set pop
END(truncate)
.globl truncate64
.equ truncate64, truncate
ALIAS_SYMBOL(truncate64, truncate)

View File

@ -3,8 +3,14 @@
// pid_t __bionic_clone(int flags, void* child_stack, pid_t* parent_tid, void* tls, pid_t* child_tid, int (*fn)(void*), void* arg);
ENTRY(__bionic_clone)
pushl %ebx
.cfi_adjust_cfa_offset 4
.cfi_rel_offset ebx, 0
pushl %esi
.cfi_adjust_cfa_offset 4
.cfi_rel_offset esi, 0
pushl %edi
.cfi_adjust_cfa_offset 4
.cfi_rel_offset edi, 0
# Load system call arguments into registers.
movl 16(%esp), %ebx # flags
@ -46,8 +52,14 @@ ENTRY(__bionic_clone)
# We're the parent; nothing to do.
.L_bc_return:
popl %edi
.cfi_adjust_cfa_offset -4
.cfi_restore edi
popl %esi
.cfi_adjust_cfa_offset -4
.cfi_restore esi
popl %ebx
.cfi_adjust_cfa_offset -4
.cfi_restore ebx
ret
END(__bionic_clone)
.hidden __bionic_clone

View File

@ -123,7 +123,5 @@ ENTRY(siglongjmp)
ret
END(siglongjmp)
.globl longjmp
.equ longjmp, siglongjmp
.globl _longjmp
.equ _longjmp, siglongjmp
ALIAS_SYMBOL(longjmp, siglongjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)

View File

@ -15,9 +15,17 @@
ENTRY(syscall)
# Push the callee save registers.
push %ebx
.cfi_adjust_cfa_offset 4
.cfi_rel_offset ebx, 0
push %esi
.cfi_adjust_cfa_offset 4
.cfi_rel_offset esi, 0
push %edi
.cfi_adjust_cfa_offset 4
.cfi_rel_offset edi, 0
push %ebp
.cfi_adjust_cfa_offset 4
.cfi_rel_offset ebp, 0
# Load all the arguments from the calling frame.
# (Not all will be valid, depending on the syscall.)
@ -43,8 +51,16 @@ ENTRY(syscall)
1:
# Restore the callee save registers.
pop %ebp
.cfi_adjust_cfa_offset -4
.cfi_restore ebp
pop %edi
.cfi_adjust_cfa_offset -4
.cfi_restore edi
pop %esi
.cfi_adjust_cfa_offset -4
.cfi_restore esi
pop %ebx
.cfi_adjust_cfa_offset -4
.cfi_restore ebx
ret
END(syscall)

View File

@ -32,6 +32,8 @@
ENTRY(vfork)
popl %ecx // Grab the return address.
.cfi_adjust_cfa_offset 4
.cfi_rel_offset ecx, 0
movl $__NR_vfork, %eax
int $0x80
cmpl $-MAX_ERRNO, %eax

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(close)
ENTRY(___close)
pushl %ebx
.cfi_def_cfa_offset 8
.cfi_rel_offset ebx, 0
@ -18,4 +18,5 @@ ENTRY(close)
1:
popl %ebx
ret
END(close)
END(___close)
.hidden ___close

View File

@ -20,5 +20,4 @@ ENTRY(_exit)
ret
END(_exit)
.globl _Exit
.equ _Exit, _exit
ALIAS_SYMBOL(_Exit, _exit)

View File

@ -25,5 +25,4 @@ ENTRY(fstat64)
ret
END(fstat64)
.globl fstat
.equ fstat, fstat64
ALIAS_SYMBOL(fstat, fstat64)

View File

@ -35,5 +35,4 @@ ENTRY(fstatat64)
ret
END(fstatat64)
.globl fstatat
.equ fstatat, fstatat64
ALIAS_SYMBOL(fstatat, fstatat64)

View File

@ -129,7 +129,5 @@ ENTRY(siglongjmp)
ret
END(siglongjmp)
.globl longjmp
.equ longjmp, siglongjmp
.globl _longjmp
.equ _longjmp, siglongjmp
ALIAS_SYMBOL(longjmp, siglongjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)

View File

@ -1897,8 +1897,8 @@ L(strcmp_exitz):
.p2align 4
L(Byte0):
movzx (%rsi), %ecx
movzx (%rdi), %eax
movzbl (%rsi), %ecx
movzbl (%rdi), %eax
sub %ecx, %eax
ret

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(close)
ENTRY(___close)
movl $__NR_close, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@ -12,4 +12,5 @@ ENTRY(close)
call __set_errno_internal
1:
ret
END(close)
END(___close)
.hidden ___close

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(fstatfs64)
ENTRY(__fstatfs)
movl $__NR_fstatfs, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@ -12,7 +12,5 @@ ENTRY(fstatfs64)
call __set_errno_internal
1:
ret
END(fstatfs64)
.globl fstatfs
.equ fstatfs, fstatfs64
END(__fstatfs)
.hidden __fstatfs

View File

@ -2,7 +2,7 @@
#include <private/bionic_asm.h>
ENTRY(statfs64)
ENTRY(__statfs)
movl $__NR_statfs, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@ -12,7 +12,5 @@ ENTRY(statfs64)
call __set_errno_internal
1:
ret
END(statfs64)
.globl statfs
.equ statfs, statfs64
END(__statfs)
.hidden __statfs

View File

@ -14,5 +14,4 @@ ENTRY(_exit)
ret
END(_exit)
.globl _Exit
.equ _Exit, _exit
ALIAS_SYMBOL(_Exit, _exit)

View File

@ -15,5 +15,4 @@ ENTRY(fallocate)
ret
END(fallocate)
.globl fallocate64
.equ fallocate64, fallocate
ALIAS_SYMBOL(fallocate64, fallocate)

View File

@ -14,5 +14,4 @@ ENTRY(fstat64)
ret
END(fstat64)
.globl fstat
.equ fstat, fstat64
ALIAS_SYMBOL(fstat, fstat64)

View File

@ -15,5 +15,4 @@ ENTRY(fstatat64)
ret
END(fstatat64)
.globl fstatat
.equ fstatat, fstatat64
ALIAS_SYMBOL(fstatat, fstatat64)

View File

@ -14,5 +14,4 @@ ENTRY(ftruncate)
ret
END(ftruncate)
.globl ftruncate64
.equ ftruncate64, ftruncate
ALIAS_SYMBOL(ftruncate64, ftruncate)

View File

@ -14,5 +14,4 @@ ENTRY(getrlimit)
ret
END(getrlimit)
.globl getrlimit64
.equ getrlimit64, getrlimit
ALIAS_SYMBOL(getrlimit64, getrlimit)

View File

@ -14,5 +14,4 @@ ENTRY(lseek)
ret
END(lseek)
.globl lseek64
.equ lseek64, lseek
ALIAS_SYMBOL(lseek64, lseek)

View File

@ -15,5 +15,4 @@ ENTRY(mmap)
ret
END(mmap)
.globl mmap64
.equ mmap64, mmap
ALIAS_SYMBOL(mmap64, mmap)

View File

@ -15,5 +15,4 @@ ENTRY(pread64)
ret
END(pread64)
.globl pread
.equ pread, pread64
ALIAS_SYMBOL(pread, pread64)

View File

@ -15,5 +15,4 @@ ENTRY(prlimit64)
ret
END(prlimit64)
.globl prlimit
.equ prlimit, prlimit64
ALIAS_SYMBOL(prlimit, prlimit64)

View File

@ -15,5 +15,4 @@ ENTRY(pwrite64)
ret
END(pwrite64)
.globl pwrite
.equ pwrite, pwrite64
ALIAS_SYMBOL(pwrite, pwrite64)

View File

@ -15,5 +15,4 @@ ENTRY(sendfile)
ret
END(sendfile)
.globl sendfile64
.equ sendfile64, sendfile
ALIAS_SYMBOL(sendfile64, sendfile)

View File

@ -14,5 +14,4 @@ ENTRY(setrlimit)
ret
END(setrlimit)
.globl setrlimit64
.equ setrlimit64, setrlimit
ALIAS_SYMBOL(setrlimit64, setrlimit)

View File

@ -14,5 +14,4 @@ ENTRY(truncate)
ret
END(truncate)
.globl truncate64
.equ truncate64, truncate
ALIAS_SYMBOL(truncate64, truncate)

View File

@ -34,7 +34,7 @@ static void netdClientInitFunction(void* handle, const char* symbol, FunctionTyp
}
static void netdClientInitImpl() {
void* netdClientHandle = dlopen("libnetd_client.so", RTLD_LAZY);
void* netdClientHandle = dlopen("libnetd_client.so", RTLD_NOW);
if (netdClientHandle == NULL) {
// If the library is not available, it's not an error. We'll just use
// default implementations of functions that it would've overridden.

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <sys/cdefs.h>
struct thread_local_dtor {
void (*func) (void *);
void *arg;
void *dso_handle; // unused...
thread_local_dtor* next;
};
static __thread thread_local_dtor* thread_local_dtors = nullptr;
extern "C" int __cxa_thread_atexit_impl(void (*func) (void *), void *arg, void *dso_handle) {
thread_local_dtor* dtor = new thread_local_dtor();
dtor->func = func;
dtor->arg = arg;
dtor->dso_handle = dso_handle;
dtor->next = thread_local_dtors;
thread_local_dtors = dtor;
return 0;
}
extern "C" __LIBC_HIDDEN__ void __cxa_thread_finalize() {
while (thread_local_dtors != nullptr) {
thread_local_dtor* current = thread_local_dtors;
thread_local_dtors = current->next;
current->func(current->arg);
delete current;
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#undef _FORTIFY_SOURCE
#include <string.h>
#include "private/libc_logging.h"
extern "C" void* __memchr_chk(const void* s, int c, size_t n, size_t buf_size) {
if (__predict_false(n > buf_size)) {
__fortify_chk_fail("memchr: prevented read past end of buffer", 0);
}
return memchr(s, c, n);
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#undef _FORTIFY_SOURCE
#include <string.h>
#include "private/libc_logging.h"
extern "C" void* __memrchr_chk(const void* s, int c, size_t n, size_t buf_size) {
if (__predict_false(n > buf_size)) {
__fortify_chk_fail("memrchr: prevented read past end of buffer", 0);
}
return memrchr(s, c, n);
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#undef _FORTIFY_SOURCE
#include <unistd.h>
#include "private/libc_logging.h"
extern "C" ssize_t __pread64_chk(int fd, void* buf, size_t count, off64_t offset, size_t buf_size) {
if (__predict_false(count > buf_size)) {
__fortify_chk_fail("pread64: prevented write past end of buffer", 0);
}
if (__predict_false(count > SSIZE_MAX)) {
__fortify_chk_fail("pread64: count > SSIZE_MAX", 0);
}
return pread64(fd, buf, count, offset);
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#undef _FORTIFY_SOURCE
#include <unistd.h>
#include "private/libc_logging.h"
extern "C" ssize_t __pread_chk(int fd, void* buf, size_t count, off_t offset, size_t buf_size) {
if (__predict_false(count > buf_size)) {
__fortify_chk_fail("pread: prevented write past end of buffer", 0);
}
if (__predict_false(count > SSIZE_MAX)) {
__fortify_chk_fail("pread: count > SSIZE_MAX", 0);
}
return pread(fd, buf, count, offset);
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#undef _FORTIFY_SOURCE
#include <unistd.h>
#include "private/libc_logging.h"
extern "C" ssize_t __readlink_chk(const char* path, char* buf, size_t size, size_t buf_size) {
if (__predict_false(size > buf_size)) {
__fortify_chk_fail("readlink: prevented write past end of buffer", 0);
}
if (__predict_false(size > SSIZE_MAX)) {
__fortify_chk_fail("readlink: size > SSIZE_MAX", 0);
}
return readlink(path, buf, size);
}

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#undef _FORTIFY_SOURCE
#include <unistd.h>
#include "private/libc_logging.h"
extern "C" ssize_t __readlinkat_chk(int dirfd, const char* path, char* buf, size_t size, size_t buf_size) {
if (__predict_false(size > buf_size)) {
__fortify_chk_fail("readlinkat: prevented write past end of buffer", 0);
}
if (__predict_false(size > SSIZE_MAX)) {
__fortify_chk_fail("readlinkat: size > SSIZE_MAX", 0);
}
return readlinkat(dirfd, path, buf, size);
}

56
libc/bionic/close.cpp Normal file
View File

@ -0,0 +1,56 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <errno.h>
#include <unistd.h>
extern "C" int ___close(int);
int close(int fd) {
int rc = ___close(fd);
if (rc == -1 && errno == EINTR) {
// POSIX says that if close returns with EINTR, the fd must not be closed.
// Linus disagrees: http://lkml.indiana.edu/hypermail/linux/kernel/0509.1/0877.html
// The future POSIX solution is posix_close (http://austingroupbugs.net/view.php?id=529),
// with the state after EINTR being undefined, and EINPROGRESS for the case where close
// was interrupted by a signal but the file descriptor was actually closed.
// My concern with that future behavior is that it breaks existing code that assumes
// that close only returns -1 if it failed. Unlike other system calls, I have real
// difficulty even imagining a caller that would need to know that close was interrupted
// but succeeded. So returning EINTR is wrong (because Linux always closes) and EINPROGRESS
// is harmful because callers need to be rewritten to understand that EINPROGRESS isn't
// actually a failure, but will be reported as one.
// We don't restore errno because that would incur a cost (the TLS read) for every caller.
// Since callers don't know ahead of time whether close will legitimately fail, they need
// to have stashed the old errno value anyway if they plan on using it afterwards, so
// us clobbering errno here doesn't change anything in that respect.
return 0;
}
return rc;
}

View File

@ -31,6 +31,7 @@
#include <sys/auxv.h>
#include <private/bionic_auxv.h>
#include <elf.h>
#include <errno.h>
__LIBC_HIDDEN__ ElfW(auxv_t)* __libc_auxv = NULL;
@ -40,5 +41,6 @@ extern "C" unsigned long int getauxval(unsigned long int type) {
return v->a_un.a_val;
}
}
errno = ENOENT;
return 0;
}

Some files were not shown because too many files have changed in this diff Show More