am 8826ba8a: am bc545e8a: Merge "Fix x86_64 build, clean up intermediate libraries."
* commit '8826ba8ab6922927bdac2466d2903916d5806a06': Fix x86_64 build, clean up intermediate libraries.
This commit is contained in:
commit
1cdc9fe6d5
@ -152,34 +152,38 @@ libc_common_src_files := \
|
|||||||
bionic/usleep.c \
|
bionic/usleep.c \
|
||||||
bionic/utmp.c \
|
bionic/utmp.c \
|
||||||
bionic/wcscoll.c \
|
bionic/wcscoll.c \
|
||||||
|
|
||||||
|
|
||||||
|
libc_dns_src_files += \
|
||||||
netbsd/gethnamaddr.c \
|
netbsd/gethnamaddr.c \
|
||||||
netbsd/inet/nsap_addr.c \
|
netbsd/inet/nsap_addr.c \
|
||||||
|
netbsd/nameser/ns_name.c \
|
||||||
|
netbsd/nameser/ns_netint.c \
|
||||||
|
netbsd/nameser/ns_parse.c \
|
||||||
|
netbsd/nameser/ns_print.c \
|
||||||
|
netbsd/nameser/ns_samedomain.c \
|
||||||
|
netbsd/nameser/ns_ttl.c \
|
||||||
|
netbsd/net/base64.c \
|
||||||
|
netbsd/net/getaddrinfo.c \
|
||||||
|
netbsd/net/getnameinfo.c \
|
||||||
|
netbsd/net/getservbyname.c \
|
||||||
|
netbsd/net/getservbyport.c \
|
||||||
|
netbsd/net/getservent.c \
|
||||||
|
netbsd/net/nsdispatch.c \
|
||||||
netbsd/resolv/__dn_comp.c \
|
netbsd/resolv/__dn_comp.c \
|
||||||
netbsd/resolv/__res_close.c \
|
|
||||||
netbsd/resolv/__res_send.c \
|
|
||||||
netbsd/resolv/herror.c \
|
netbsd/resolv/herror.c \
|
||||||
|
netbsd/resolv/res_cache.c \
|
||||||
|
netbsd/resolv/__res_close.c \
|
||||||
netbsd/resolv/res_comp.c \
|
netbsd/resolv/res_comp.c \
|
||||||
netbsd/resolv/res_data.c \
|
netbsd/resolv/res_data.c \
|
||||||
netbsd/resolv/res_debug.c \
|
netbsd/resolv/res_debug.c \
|
||||||
netbsd/resolv/res_init.c \
|
netbsd/resolv/res_init.c \
|
||||||
netbsd/resolv/res_mkquery.c \
|
netbsd/resolv/res_mkquery.c \
|
||||||
netbsd/resolv/res_query.c \
|
netbsd/resolv/res_query.c \
|
||||||
|
netbsd/resolv/__res_send.c \
|
||||||
netbsd/resolv/res_send.c \
|
netbsd/resolv/res_send.c \
|
||||||
netbsd/resolv/res_state.c \
|
netbsd/resolv/res_state.c \
|
||||||
netbsd/resolv/res_cache.c \
|
|
||||||
netbsd/net/nsdispatch.c \
|
|
||||||
netbsd/net/getaddrinfo.c \
|
|
||||||
netbsd/net/getnameinfo.c \
|
|
||||||
netbsd/net/getservbyname.c \
|
|
||||||
netbsd/net/getservent.c \
|
|
||||||
netbsd/net/base64.c \
|
|
||||||
netbsd/net/getservbyport.c \
|
|
||||||
netbsd/nameser/ns_name.c \
|
|
||||||
netbsd/nameser/ns_parse.c \
|
|
||||||
netbsd/nameser/ns_ttl.c \
|
|
||||||
netbsd/nameser/ns_netint.c \
|
|
||||||
netbsd/nameser/ns_print.c \
|
|
||||||
netbsd/nameser/ns_samedomain.c \
|
|
||||||
|
|
||||||
# These are shared by all the 32-bit targets, but not the 64-bit ones.
|
# These are shared by all the 32-bit targets, but not the 64-bit ones.
|
||||||
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
|
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
|
||||||
@ -256,6 +260,7 @@ libc_bionic_src_files := \
|
|||||||
bionic/stubs.cpp \
|
bionic/stubs.cpp \
|
||||||
bionic/sysconf.cpp \
|
bionic/sysconf.cpp \
|
||||||
bionic/tdestroy.cpp \
|
bionic/tdestroy.cpp \
|
||||||
|
bionic/__thread_entry.cpp \
|
||||||
bionic/tmpfile.cpp \
|
bionic/tmpfile.cpp \
|
||||||
bionic/wait.cpp \
|
bionic/wait.cpp \
|
||||||
bionic/wchar.cpp \
|
bionic/wchar.cpp \
|
||||||
@ -509,7 +514,7 @@ libc_common_src_files += \
|
|||||||
bionic/pthread-atfork.c \
|
bionic/pthread-atfork.c \
|
||||||
bionic/pthread-rwlocks.c \
|
bionic/pthread-rwlocks.c \
|
||||||
bionic/pthread-timers.c \
|
bionic/pthread-timers.c \
|
||||||
bionic/ptrace.c
|
bionic/ptrace.c \
|
||||||
|
|
||||||
libc_static_common_src_files += \
|
libc_static_common_src_files += \
|
||||||
bionic/pthread.c \
|
bionic/pthread.c \
|
||||||
@ -551,8 +556,8 @@ libc_common_additional_dependencies += \
|
|||||||
$(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
|
$(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
|
||||||
include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
|
include $(LOCAL_PATH)/arch-$(TARGET_ARCH)/$(TARGET_ARCH).mk
|
||||||
|
|
||||||
libc_common_src_files += $(_LIBC_ARCH_COMMON_SRC_FILES)
|
libc_bionic_src_files += $(_LIBC_ARCH_COMMON_SRC_FILES)
|
||||||
libc_common_src_files += $(_LIBC_ARCH_CPU_VARIANT_SRC_FILES)
|
libc_bionic_src_files += $(_LIBC_ARCH_CPU_VARIANT_SRC_FILES)
|
||||||
libc_arch_static_src_files := $(_LIBC_ARCH_STATIC_SRC_FILES)
|
libc_arch_static_src_files := $(_LIBC_ARCH_STATIC_SRC_FILES)
|
||||||
libc_arch_dynamic_src_files := $(_LIBC_ARCH_DYNAMIC_SRC_FILES)
|
libc_arch_dynamic_src_files := $(_LIBC_ARCH_DYNAMIC_SRC_FILES)
|
||||||
libc_common_additional_dependencies += $(_LIBC_ARCH_ADDITIONAL_DEPENDENCIES)
|
libc_common_additional_dependencies += $(_LIBC_ARCH_ADDITIONAL_DEPENDENCIES)
|
||||||
@ -562,9 +567,6 @@ libc_common_additional_dependencies += $(_LIBC_ARCH_ADDITIONAL_DEPENDENCIES)
|
|||||||
libc_common_cflags := \
|
libc_common_cflags := \
|
||||||
-DANDROID_CHANGES \
|
-DANDROID_CHANGES \
|
||||||
-D_LIBC=1 \
|
-D_LIBC=1 \
|
||||||
-DINET6 \
|
|
||||||
-I$(LOCAL_PATH)/private \
|
|
||||||
-DPOSIX_MISTAKE \
|
|
||||||
-Wall -Wextra \
|
-Wall -Wextra \
|
||||||
|
|
||||||
# Try to catch typical 32-bit assumptions that break with 64-bit pointers.
|
# Try to catch typical 32-bit assumptions that break with 64-bit pointers.
|
||||||
@ -618,7 +620,8 @@ endif
|
|||||||
# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
|
# crtbrand.c needs <stdint.h> and a #define for the platform SDK version.
|
||||||
libc_crt_target_cflags += \
|
libc_crt_target_cflags += \
|
||||||
-I$(LOCAL_PATH)/include \
|
-I$(LOCAL_PATH)/include \
|
||||||
-DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION)
|
-I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include \
|
||||||
|
-DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
|
||||||
|
|
||||||
# Define some common conlyflags
|
# Define some common conlyflags
|
||||||
libc_common_conlyflags := \
|
libc_common_conlyflags := \
|
||||||
@ -636,12 +639,6 @@ libc_common_c_includes := \
|
|||||||
$(LOCAL_PATH)/stdio \
|
$(LOCAL_PATH)/stdio \
|
||||||
external/safe-iop/include
|
external/safe-iop/include
|
||||||
|
|
||||||
# Needed to access private/__dso_handle.h from
|
|
||||||
# crtbegin_xxx.S and crtend_xxx.S
|
|
||||||
libc_crt_target_cflags += \
|
|
||||||
-I$(LOCAL_PATH)/private \
|
|
||||||
-I$(LOCAL_PATH)/arch-$(TARGET_ARCH)/include
|
|
||||||
|
|
||||||
# Define the libc run-time (crt) support object files that must be built,
|
# Define the libc run-time (crt) support object files that must be built,
|
||||||
# which are needed to build all other objects (shared/static libs and
|
# which are needed to build all other objects (shared/static libs and
|
||||||
# executables)
|
# executables)
|
||||||
@ -810,6 +807,29 @@ LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
|||||||
include $(BUILD_STATIC_LIBRARY)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
|
# ========================================================
|
||||||
|
# libc_dns.a - modified NetBSD DNS code
|
||||||
|
# ========================================================
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := $(libc_dns_src_files)
|
||||||
|
LOCAL_CFLAGS := \
|
||||||
|
$(libc_common_cflags) \
|
||||||
|
-DINET6 \
|
||||||
|
-I$(LOCAL_PATH)/private \
|
||||||
|
-I$(LOCAL_PATH)/upstream-netbsd/libc/include # for NetBSD private headers
|
||||||
|
|
||||||
|
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
|
||||||
|
LOCAL_CPPFLAGS := $(libc_common_cppflags)
|
||||||
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
|
LOCAL_MODULE := libc_dns
|
||||||
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
|
||||||
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
# ========================================================
|
# ========================================================
|
||||||
# libc_freebsd.a - upstream FreeBSD C library code
|
# libc_freebsd.a - upstream FreeBSD C library code
|
||||||
# ========================================================
|
# ========================================================
|
||||||
@ -847,6 +867,7 @@ include $(CLEAR_VARS)
|
|||||||
LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
|
LOCAL_SRC_FILES := $(libc_upstream_netbsd_src_files)
|
||||||
LOCAL_CFLAGS := \
|
LOCAL_CFLAGS := \
|
||||||
$(libc_common_cflags) \
|
$(libc_common_cflags) \
|
||||||
|
-DPOSIX_MISTAKE \
|
||||||
-I$(LOCAL_PATH)/upstream-netbsd \
|
-I$(LOCAL_PATH)/upstream-netbsd \
|
||||||
-I$(LOCAL_PATH)/upstream-netbsd/libc/include \
|
-I$(LOCAL_PATH)/upstream-netbsd/libc/include \
|
||||||
-include upstream-netbsd/netbsd-compat.h
|
-include upstream-netbsd/netbsd-compat.h
|
||||||
@ -885,8 +906,7 @@ include $(BUILD_STATIC_LIBRARY)
|
|||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_SRC_FILES := $(libc_common_src_files)
|
LOCAL_SRC_FILES := $(libc_common_src_files)
|
||||||
LOCAL_CFLAGS := $(libc_common_cflags) \
|
LOCAL_CFLAGS := $(libc_common_cflags)
|
||||||
-I$(LOCAL_PATH)/upstream-netbsd/libc/include # for netbsd private headers
|
|
||||||
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
|
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
|
||||||
LOCAL_CPPFLAGS := $(libc_common_cppflags)
|
LOCAL_CPPFLAGS := $(libc_common_cppflags)
|
||||||
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
LOCAL_C_INCLUDES := $(libc_common_c_includes)
|
||||||
@ -895,9 +915,11 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies)
|
|||||||
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
LOCAL_WHOLE_STATIC_LIBRARIES := \
|
||||||
libbionic_ssp \
|
libbionic_ssp \
|
||||||
libc_bionic \
|
libc_bionic \
|
||||||
|
libc_dns \
|
||||||
libc_freebsd \
|
libc_freebsd \
|
||||||
libc_netbsd \
|
libc_netbsd \
|
||||||
libc_tzcode
|
libc_tzcode \
|
||||||
|
|
||||||
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
LOCAL_SYSTEM_SHARED_LIBRARIES :=
|
||||||
|
|
||||||
# TODO: split out the asflags.
|
# TODO: split out the asflags.
|
||||||
|
@ -27,9 +27,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <private/libc_logging.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This source file should only be included by libc.so, its purpose is
|
* This source file should only be included by libc.so, its purpose is
|
||||||
* to support legacy ARM binaries by exporting a publicly visible
|
* to support legacy ARM binaries by exporting a publicly visible
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
.syntax unified
|
.syntax unified
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
.syntax unified
|
.syntax unified
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
// Prototype: void *memcpy (void *dst, const void *src, size_t count).
|
// Prototype: void *memcpy (void *dst, const void *src, size_t count).
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.syntax unified
|
.syntax unified
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <machine/cpu-features.h>
|
#include <machine/cpu-features.h>
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Optimized memset() for ARM.
|
* Optimized memset() for ARM.
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
.syntax unified
|
.syntax unified
|
||||||
.fpu neon
|
.fpu neon
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
.syntax unified
|
.syntax unified
|
||||||
.fpu neon
|
.fpu neon
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This code assumes it is running on a processor that supports all arm v7
|
* This code assumes it is running on a processor that supports all arm v7
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <machine/cpu-features.h>
|
#include <machine/cpu-features.h>
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This code assumes it is running on a processor that supports all arm v7
|
* This code assumes it is running on a processor that supports all arm v7
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <machine/cpu-features.h>
|
#include <machine/cpu-features.h>
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Optimized memcpy() for ARM.
|
* Optimized memcpy() for ARM.
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Optimized memset() for ARM.
|
* Optimized memset() for ARM.
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
.syntax unified
|
.syntax unified
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
.syntax unified
|
.syntax unified
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
/* Assumes neon instructions and a cache line size of 32 bytes. */
|
/* Assumes neon instructions and a cache line size of 32 bytes. */
|
||||||
|
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This code assumes it is running on a processor that supports all arm v7
|
* This code assumes it is running on a processor that supports all arm v7
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <machine/cpu-features.h>
|
#include <machine/cpu-features.h>
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include "libc_events.h"
|
#include "private/libc_events.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This code assumes it is running on a processor that supports all arm v7
|
* This code assumes it is running on a processor that supports all arm v7
|
||||||
|
@ -59,4 +59,3 @@ void __on_dlclose() {
|
|||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
# include "../../arch-x86/bionic/__stack_chk_fail_local.h"
|
# include "../../arch-x86/bionic/__stack_chk_fail_local.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <sys/cachectl.h>
|
#include <sys/cachectl.h>
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#include <private/libc_logging.h>
|
#include "private/libc_logging.h"
|
||||||
#define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc-cacheflush",__VA_ARGS__)
|
#define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc-cacheflush",__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -90,5 +90,5 @@ __asm__ (
|
|||||||
" .set pop \n"
|
" .set pop \n"
|
||||||
);
|
);
|
||||||
|
|
||||||
#include "__dso_handle.h"
|
#include "../../arch-common/bionic/__dso_handle.h"
|
||||||
#include "atexit.h"
|
#include "atexit.h"
|
||||||
|
@ -34,5 +34,5 @@ void __on_dlclose() {
|
|||||||
__cxa_finalize(&__dso_handle);
|
__cxa_finalize(&__dso_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "__dso_handle_so.h"
|
#include "../../arch-common/bionic/__dso_handle_so.h"
|
||||||
#include "atexit.h"
|
#include "atexit.h"
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#undef _FORTIFY_SOURCE
|
#undef _FORTIFY_SOURCE
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
extern "C" int __FD_ISSET_chk(int fd, fd_set* set, size_t set_size) {
|
extern "C" int __FD_ISSET_chk(int fd, fd_set* set, size_t set_size) {
|
||||||
if (__predict_false(fd < 0)) {
|
if (__predict_false(fd < 0)) {
|
||||||
|
@ -27,9 +27,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <bionic_tls.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "private/bionic_tls.h"
|
||||||
|
|
||||||
volatile int* __errno() {
|
volatile int* __errno() {
|
||||||
return reinterpret_cast<int*>(&(__get_tls()[TLS_SLOT_ERRNO]));
|
return reinterpret_cast<int*>(&(__get_tls()[TLS_SLOT_ERRNO]));
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __fgets_chk. Called in place of fgets() when we know the
|
* __fgets_chk. Called in place of fgets() when we know the
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#undef _FORTIFY_SOURCE
|
#undef _FORTIFY_SOURCE
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __memcpy_chk.
|
* Runtime implementation of __memcpy_chk.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __builtin____memmove_chk.
|
* Runtime implementation of __builtin____memmove_chk.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __builtin____memset_chk.
|
* Runtime implementation of __builtin____memset_chk.
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
ssize_t __recvfrom_chk(int socket, void* buf, size_t len, size_t buflen, unsigned int flags,
|
ssize_t __recvfrom_chk(int socket, void* buf, size_t len, size_t buflen, unsigned int flags,
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "bionic_ssp.h"
|
#include "private/bionic_ssp.h"
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
void __stack_chk_fail() {
|
void __stack_chk_fail() {
|
||||||
__libc_fatal("stack corruption detected");
|
__libc_fatal("stack corruption detected");
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __builtin____strcat_chk.
|
* Runtime implementation of __builtin____strcat_chk.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
extern "C" char* __strchr_chk(const char* p, int ch, size_t s_len) {
|
extern "C" char* __strchr_chk(const char* p, int ch, size_t s_len) {
|
||||||
for (;; ++p, s_len--) {
|
for (;; ++p, s_len--) {
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __builtin____strcpy_chk.
|
* Runtime implementation of __builtin____strcpy_chk.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __strlcat_chk. Called in place of strlcat() when we know the
|
* __strlcat_chk. Called in place of strlcat() when we know the
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* __strlcpy_chk. Called in place of strlcpy() when we know the
|
* __strlcpy_chk. Called in place of strlcpy() when we know the
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __strlen_chk.
|
* Runtime implementation of __strlen_chk.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __builtin____strncat_chk.
|
* Runtime implementation of __builtin____strncat_chk.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __builtin____strncpy_chk.
|
* Runtime implementation of __builtin____strncpy_chk.
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
extern "C" char* __strrchr_chk(const char *p, int ch, size_t s_len)
|
extern "C" char* __strrchr_chk(const char *p, int ch, size_t s_len)
|
||||||
{
|
{
|
||||||
|
57
libc/bionic/__thread_entry.cpp
Normal file
57
libc/bionic/__thread_entry.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 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 <pthread.h>
|
||||||
|
|
||||||
|
#include "pthread_internal.h"
|
||||||
|
|
||||||
|
#include "private/bionic_tls.h"
|
||||||
|
|
||||||
|
// This trampoline is called from the assembly _pthread_clone function.
|
||||||
|
// Our 'tls' and __pthread_clone's 'child_stack' are one and the same, just growing in
|
||||||
|
// opposite directions.
|
||||||
|
extern "C" void __thread_entry(void* (*func)(void*), void* arg, void** tls) {
|
||||||
|
// Wait for our creating thread to release us. This lets it have time to
|
||||||
|
// notify gdb about this thread before we start doing anything.
|
||||||
|
// This also provides the memory barrier needed to ensure that all memory
|
||||||
|
// accesses previously made by the creating thread are visible to us.
|
||||||
|
pthread_mutex_t* start_mutex = (pthread_mutex_t*) &tls[TLS_SLOT_SELF];
|
||||||
|
pthread_mutex_lock(start_mutex);
|
||||||
|
pthread_mutex_destroy(start_mutex);
|
||||||
|
|
||||||
|
pthread_internal_t* thread = (pthread_internal_t*) tls[TLS_SLOT_THREAD_ID];
|
||||||
|
thread->tls = tls;
|
||||||
|
__init_tls(thread);
|
||||||
|
|
||||||
|
if ((thread->internal_flags & PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED) != 0) {
|
||||||
|
pthread_exit(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* result = func(arg);
|
||||||
|
pthread_exit(result);
|
||||||
|
}
|
@ -30,9 +30,10 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "libc_logging.h"
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __umask_chk.
|
* Runtime implementation of __umask_chk.
|
||||||
*
|
*
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __builtin____vsnprintf_chk.
|
* Runtime implementation of __builtin____vsnprintf_chk.
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runtime implementation of __builtin____vsprintf_chk.
|
* Runtime implementation of __builtin____vsprintf_chk.
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include "thread_private.h"
|
#include "private/thread_private.h"
|
||||||
|
|
||||||
/* BIONIC-BEGIN */
|
/* BIONIC-BEGIN */
|
||||||
/* this lock should protect the global variables in this file */
|
/* this lock should protect the global variables in this file */
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
void __assert(const char* file, int line, const char* failed_expression) {
|
void __assert(const char* file, int line, const char* failed_expression) {
|
||||||
__libc_fatal("%s:%d: assertion \"%s\" failed", file, line, failed_expression);
|
__libc_fatal("%s:%d: assertion \"%s\" failed", file, line, failed_expression);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "debug_mapinfo.h"
|
#include "debug_mapinfo.h"
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/* depends how the system includes define this */
|
/* depends how the system includes define this */
|
||||||
#ifdef HAVE_UNWIND_CONTEXT_STRUCT
|
#ifdef HAVE_UNWIND_CONTEXT_STRUCT
|
||||||
|
@ -27,9 +27,10 @@
|
|||||||
*/
|
*/
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "pthread_internal.h"
|
#include "pthread_internal.h"
|
||||||
#include "bionic_pthread.h"
|
|
||||||
#include "cpuacct.h"
|
#include "cpuacct.h"
|
||||||
|
|
||||||
|
#include "private/bionic_pthread.h"
|
||||||
|
|
||||||
extern int __fork(void);
|
extern int __fork(void);
|
||||||
|
|
||||||
int fork(void)
|
int fork(void)
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
#include "libc_init_common.h"
|
#include "libc_init_common.h"
|
||||||
|
|
||||||
#include <asm/page.h>
|
|
||||||
#include <bionic_tls.h>
|
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@ -44,6 +42,7 @@
|
|||||||
#include "atexit.h"
|
#include "atexit.h"
|
||||||
#include "private/bionic_auxv.h"
|
#include "private/bionic_auxv.h"
|
||||||
#include "private/bionic_ssp.h"
|
#include "private/bionic_ssp.h"
|
||||||
|
#include "private/bionic_tls.h"
|
||||||
#include "private/KernelArgumentBlock.h"
|
#include "private/KernelArgumentBlock.h"
|
||||||
#include "pthread_internal.h"
|
#include "pthread_internal.h"
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ const char* __progname;
|
|||||||
// Declared in <unistd.h>.
|
// Declared in <unistd.h>.
|
||||||
char** environ;
|
char** environ;
|
||||||
|
|
||||||
// Declared in <private/bionic_ssp.h>.
|
// Declared in "private/bionic_ssp.h".
|
||||||
uintptr_t __stack_chk_guard = 0;
|
uintptr_t __stack_chk_guard = 0;
|
||||||
|
|
||||||
static size_t get_main_thread_stack_size() {
|
static size_t get_main_thread_stack_size() {
|
||||||
|
@ -49,9 +49,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
#include "atexit.h"
|
#include "atexit.h"
|
||||||
#include "KernelArgumentBlock.h"
|
|
||||||
#include "libc_init_common.h"
|
#include "libc_init_common.h"
|
||||||
#include <bionic_tls.h>
|
|
||||||
|
#include "private/bionic_tls.h"
|
||||||
|
#include "private/KernelArgumentBlock.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
extern void pthread_debug_init(void);
|
extern void pthread_debug_init(void);
|
||||||
|
@ -47,11 +47,12 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
#include "atexit.h"
|
#include "atexit.h"
|
||||||
#include "bionic_tls.h"
|
|
||||||
#include "KernelArgumentBlock.h"
|
|
||||||
#include "libc_init_common.h"
|
#include "libc_init_common.h"
|
||||||
#include "pthread_internal.h"
|
#include "pthread_internal.h"
|
||||||
|
|
||||||
|
#include "private/bionic_tls.h"
|
||||||
|
#include "private/KernelArgumentBlock.h"
|
||||||
|
|
||||||
// Returns the address of the page containing address 'x'.
|
// Returns the address of the page containing address 'x'.
|
||||||
#define PAGE_START(x) ((x) & PAGE_MASK)
|
#define PAGE_START(x) ((x) & PAGE_MASK)
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <../private/libc_logging.h> // Relative path so we can #include this .cpp file for testing.
|
#include "../private/libc_logging.h" // Relative path so we can #include this .cpp file for testing.
|
||||||
#include <../private/ScopedPthreadMutexLocker.h>
|
#include "../private/ScopedPthreadMutexLocker.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
#include "ThreadLocalBuffer.h"
|
#include "private/ThreadLocalBuffer.h"
|
||||||
|
|
||||||
GLOBAL_INIT_THREAD_LOCAL_BUFFER(basename);
|
GLOBAL_INIT_THREAD_LOCAL_BUFFER(basename);
|
||||||
GLOBAL_INIT_THREAD_LOCAL_BUFFER(dirname);
|
GLOBAL_INIT_THREAD_LOCAL_BUFFER(dirname);
|
||||||
|
@ -48,9 +48,9 @@
|
|||||||
#include "debug_mapinfo.h"
|
#include "debug_mapinfo.h"
|
||||||
#include "debug_stacktrace.h"
|
#include "debug_stacktrace.h"
|
||||||
#include "dlmalloc.h"
|
#include "dlmalloc.h"
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
#include "malloc_debug_common.h"
|
#include "malloc_debug_common.h"
|
||||||
#include "ScopedPthreadMutexLocker.h"
|
#include "private/ScopedPthreadMutexLocker.h"
|
||||||
|
|
||||||
/* libc.debug.malloc.backlog */
|
/* libc.debug.malloc.backlog */
|
||||||
extern unsigned int gMallocDebugBacklog;
|
extern unsigned int gMallocDebugBacklog;
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "dlmalloc.h"
|
#include "dlmalloc.h"
|
||||||
#include "ScopedPthreadMutexLocker.h"
|
#include "private/ScopedPthreadMutexLocker.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In a VM process, this is set to 1 after fork()ing out of zygote.
|
* In a VM process, this is set to 1 after fork()ing out of zygote.
|
||||||
@ -250,7 +250,7 @@ extern "C" size_t malloc_usable_size(const void* mem) {
|
|||||||
#include <sys/system_properties.h>
|
#include <sys/system_properties.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/* Table for dispatching malloc calls, depending on environment. */
|
/* Table for dispatching malloc calls, depending on environment. */
|
||||||
static MallocDebug gMallocUse __attribute__((aligned(32))) = {
|
static MallocDebug gMallocUse __attribute__((aligned(32))) = {
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
#define HASHTABLE_SIZE 1543
|
#define HASHTABLE_SIZE 1543
|
||||||
#define BACKTRACE_SIZE 32
|
#define BACKTRACE_SIZE 32
|
||||||
|
@ -47,9 +47,10 @@
|
|||||||
|
|
||||||
#include "debug_stacktrace.h"
|
#include "debug_stacktrace.h"
|
||||||
#include "dlmalloc.h"
|
#include "dlmalloc.h"
|
||||||
#include "libc_logging.h"
|
|
||||||
#include "malloc_debug_common.h"
|
#include "malloc_debug_common.h"
|
||||||
#include "ScopedPthreadMutexLocker.h"
|
|
||||||
|
#include "private/libc_logging.h"
|
||||||
|
#include "private/ScopedPthreadMutexLocker.h"
|
||||||
|
|
||||||
// This file should be included into the build only when
|
// This file should be included into the build only when
|
||||||
// MALLOC_LEAK_CHECK, or MALLOC_QEMU_INSTRUMENT, or both
|
// MALLOC_LEAK_CHECK, or MALLOC_QEMU_INSTRUMENT, or both
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "dlmalloc.h"
|
#include "dlmalloc.h"
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
#include "malloc_debug_common.h"
|
#include "malloc_debug_common.h"
|
||||||
|
|
||||||
/* This file should be included into the build only when
|
/* This file should be included into the build only when
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
extern int __open(const char*, int, int);
|
extern int __open(const char*, int, int);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
extern int __openat(int, const char*, int, int);
|
extern int __openat(int, const char*, int, int);
|
||||||
|
|
||||||
|
@ -34,12 +34,13 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "bionic_atomic_inline.h"
|
|
||||||
#include "bionic_futex.h"
|
|
||||||
#include "bionic_pthread.h"
|
|
||||||
#include "bionic_tls.h"
|
|
||||||
#include "pthread_internal.h"
|
#include "pthread_internal.h"
|
||||||
#include "thread_private.h"
|
|
||||||
|
#include "private/bionic_atomic_inline.h"
|
||||||
|
#include "private/bionic_futex.h"
|
||||||
|
#include "private/bionic_pthread.h"
|
||||||
|
#include "private/bionic_tls.h"
|
||||||
|
#include "private/thread_private.h"
|
||||||
|
|
||||||
extern void pthread_debug_mutex_lock_check(pthread_mutex_t *mutex);
|
extern void pthread_debug_mutex_lock_check(pthread_mutex_t *mutex);
|
||||||
extern void pthread_debug_mutex_unlock_check(pthread_mutex_t *mutex);
|
extern void pthread_debug_mutex_unlock_check(pthread_mutex_t *mutex);
|
||||||
|
@ -52,8 +52,6 @@ extern "C" void ATTRIBUTES _thread_created_hook(pid_t thread_id);
|
|||||||
|
|
||||||
extern "C" int __set_tls(void* ptr);
|
extern "C" int __set_tls(void* ptr);
|
||||||
|
|
||||||
static const int kPthreadInitFailed = 1;
|
|
||||||
|
|
||||||
static pthread_mutex_t gPthreadStackCreationLock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t gPthreadStackCreationLock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
static pthread_mutex_t gDebuggerNotificationLock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t gDebuggerNotificationLock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
@ -84,30 +82,6 @@ void __init_tls(pthread_internal_t* thread) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This trampoline is called from the assembly _pthread_clone function.
|
|
||||||
// Our 'tls' and __pthread_clone's 'child_stack' are one and the same, just growing in
|
|
||||||
// opposite directions.
|
|
||||||
extern "C" void __thread_entry(void* (*func)(void*), void* arg, void** tls) {
|
|
||||||
// Wait for our creating thread to release us. This lets it have time to
|
|
||||||
// notify gdb about this thread before we start doing anything.
|
|
||||||
// This also provides the memory barrier needed to ensure that all memory
|
|
||||||
// accesses previously made by the creating thread are visible to us.
|
|
||||||
pthread_mutex_t* start_mutex = (pthread_mutex_t*) &tls[TLS_SLOT_SELF];
|
|
||||||
pthread_mutex_lock(start_mutex);
|
|
||||||
pthread_mutex_destroy(start_mutex);
|
|
||||||
|
|
||||||
pthread_internal_t* thread = (pthread_internal_t*) tls[TLS_SLOT_THREAD_ID];
|
|
||||||
thread->tls = tls;
|
|
||||||
__init_tls(thread);
|
|
||||||
|
|
||||||
if ((thread->internal_flags & kPthreadInitFailed) != 0) {
|
|
||||||
pthread_exit(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* result = func(arg);
|
|
||||||
pthread_exit(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
__LIBC_ABI_PRIVATE__
|
__LIBC_ABI_PRIVATE__
|
||||||
int _init_thread(pthread_internal_t* thread, bool add_to_thread_list) {
|
int _init_thread(pthread_internal_t* thread, bool add_to_thread_list) {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
@ -240,7 +214,7 @@ int pthread_create(pthread_t* thread_out, pthread_attr_t const* attr,
|
|||||||
if (init_errno != 0) {
|
if (init_errno != 0) {
|
||||||
// Mark the thread detached and let its __thread_entry run to
|
// Mark the thread detached and let its __thread_entry run to
|
||||||
// completion. (It'll just exit immediately, cleaning up its resources.)
|
// completion. (It'll just exit immediately, cleaning up its resources.)
|
||||||
thread->internal_flags |= kPthreadInitFailed;
|
thread->internal_flags |= PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED;
|
||||||
thread->attr.flags |= PTHREAD_ATTR_FLAG_DETACHED;
|
thread->attr.flags |= PTHREAD_ATTR_FLAG_DETACHED;
|
||||||
return init_errno;
|
return init_errno;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include <sys/system_properties.h>
|
#include <sys/system_properties.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
//#include <dlfcn.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -40,10 +39,10 @@
|
|||||||
#include <unwind.h>
|
#include <unwind.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "bionic_tls.h"
|
#include "private/bionic_tls.h"
|
||||||
#include "debug_mapinfo.h"
|
#include "debug_mapinfo.h"
|
||||||
#include "debug_stacktrace.h"
|
#include "debug_stacktrace.h"
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ===========================================================================
|
* ===========================================================================
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "ErrnoRestorer.h"
|
#include "private/ErrnoRestorer.h"
|
||||||
#include "pthread_accessor.h"
|
#include "pthread_accessor.h"
|
||||||
|
|
||||||
int pthread_getschedparam(pthread_t t, int* policy, sched_param* param) {
|
int pthread_getschedparam(pthread_t t, int* policy, sched_param* param) {
|
||||||
|
@ -77,6 +77,8 @@ __LIBC_HIDDEN__ void _pthread_internal_remove_locked(pthread_internal_t* thread)
|
|||||||
/* Has the thread already exited but not been joined? */
|
/* Has the thread already exited but not been joined? */
|
||||||
#define PTHREAD_ATTR_FLAG_ZOMBIE 0x00000008
|
#define PTHREAD_ATTR_FLAG_ZOMBIE 0x00000008
|
||||||
|
|
||||||
|
#define PTHREAD_INTERNAL_FLAG_THREAD_INIT_FAILED 1
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Traditionally we give threads a 1MiB stack. When we started
|
* Traditionally we give threads a 1MiB stack. When we started
|
||||||
* allocating per-thread alternate signal stacks to ease debugging of
|
* allocating per-thread alternate signal stacks to ease debugging of
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#include "pthread_internal.h"
|
#include "pthread_internal.h"
|
||||||
|
|
||||||
#include "bionic_tls.h"
|
#include "private/bionic_tls.h"
|
||||||
#include "ScopedPthreadMutexLocker.h"
|
#include "private/ScopedPthreadMutexLocker.h"
|
||||||
|
|
||||||
__LIBC_HIDDEN__ pthread_internal_t* gThreadList = NULL;
|
__LIBC_HIDDEN__ pthread_internal_t* gThreadList = NULL;
|
||||||
__LIBC_HIDDEN__ pthread_mutex_t gThreadListLock = PTHREAD_MUTEX_INITIALIZER;
|
__LIBC_HIDDEN__ pthread_mutex_t gThreadListLock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "bionic_tls.h"
|
#include "private/bionic_tls.h"
|
||||||
#include "pthread_internal.h"
|
#include "pthread_internal.h"
|
||||||
|
|
||||||
/* A technical note regarding our thread-local-storage (TLS) implementation:
|
/* A technical note regarding our thread-local-storage (TLS) implementation:
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "ErrnoRestorer.h"
|
#include "private/ErrnoRestorer.h"
|
||||||
#include "pthread_accessor.h"
|
#include "pthread_accessor.h"
|
||||||
|
|
||||||
extern "C" int tgkill(int tgid, int tid, int sig);
|
extern "C" int tgkill(int tgid, int tid, int sig);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "ErrnoRestorer.h"
|
#include "private/ErrnoRestorer.h"
|
||||||
#include "pthread_accessor.h"
|
#include "pthread_accessor.h"
|
||||||
|
|
||||||
int pthread_setschedparam(pthread_t t, int policy, struct sched_param const* param) {
|
int pthread_setschedparam(pthread_t t, int policy, struct sched_param const* param) {
|
||||||
|
@ -30,10 +30,11 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/atomics.h>
|
#include <sys/atomics.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <bionic_atomic_inline.h>
|
|
||||||
#include <bionic_futex.h>
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#include "private/bionic_atomic_inline.h"
|
||||||
|
#include "private/bionic_futex.h"
|
||||||
|
|
||||||
/* In this implementation, a semaphore contains a
|
/* In this implementation, a semaphore contains a
|
||||||
* 31-bit signed value and a 1-bit 'shared' flag
|
* 31-bit signed value and a 1-bit 'shared' flag
|
||||||
* (for process-sharing purpose).
|
* (for process-sharing purpose).
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ThreadLocalBuffer.h"
|
#include "private/ThreadLocalBuffer.h"
|
||||||
|
|
||||||
extern "C" const char* __strerror_lookup(int);
|
extern "C" const char* __strerror_lookup(int);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ThreadLocalBuffer.h"
|
#include "private/ThreadLocalBuffer.h"
|
||||||
|
|
||||||
extern "C" const char* __strsignal_lookup(int);
|
extern "C" const char* __strsignal_lookup(int);
|
||||||
extern "C" const char* __strsignal(int, char*, size_t);
|
extern "C" const char* __strsignal(int, char*, size_t);
|
||||||
|
@ -26,8 +26,6 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <asm/page.h>
|
|
||||||
#include <bionic_tls.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -40,6 +38,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "private/bionic_tls.h"
|
||||||
#include "private/ScopedReaddir.h"
|
#include "private/ScopedReaddir.h"
|
||||||
|
|
||||||
/* seems to be the default on Linux, per the GLibc sources and my own digging */
|
/* seems to be the default on Linux, per the GLibc sources and my own digging */
|
||||||
|
@ -50,7 +50,8 @@
|
|||||||
#include <sys/_system_properties.h>
|
#include <sys/_system_properties.h>
|
||||||
|
|
||||||
#include <sys/atomics.h>
|
#include <sys/atomics.h>
|
||||||
#include <bionic_atomic_inline.h>
|
|
||||||
|
#include "private/bionic_atomic_inline.h"
|
||||||
|
|
||||||
#define ALIGN(x, a) (((x) + (a - 1)) & ~(a - 1))
|
#define ALIGN(x, a) (((x) + (a - 1)) & ~(a - 1))
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@
|
|||||||
|
|
||||||
#undef XLOG
|
#undef XLOG
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
# include "libc_logging.h"
|
# include "private/libc_logging.h"
|
||||||
# define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__)
|
# define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -119,7 +119,7 @@ __RCSID("$NetBSD: res_send.c,v 1.9 2006/01/24 17:41:25 christos Exp $");
|
|||||||
# include <resolv_cache.h>
|
# include <resolv_cache.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libc_logging.h"
|
#include "private/libc_logging.h"
|
||||||
|
|
||||||
#ifndef DE_CONST
|
#ifndef DE_CONST
|
||||||
#define DE_CONST(c,v) v = ((c) ? \
|
#define DE_CONST(c,v) v = ((c) ? \
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
# include "libc_logging.h"
|
# include "private/libc_logging.h"
|
||||||
# include <unistd.h> /* for gettid() */
|
# include <unistd.h> /* for gettid() */
|
||||||
# define D(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc", __VA_ARGS__)
|
# define D(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc", __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
|
@ -567,7 +567,7 @@ __END_DECLS
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
# include "libc_logging.h"
|
# include "private/libc_logging.h"
|
||||||
# define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__)
|
# define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define XLOG(...) do {} while (0)
|
#define XLOG(...) do {} while (0)
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* syscommon.h
|
|
||||||
*
|
|
||||||
* Common header file for system call stubs
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define __IN_SYS_COMMON
|
|
||||||
#include <errno.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/syscall.h>
|
|
||||||
|
|
||||||
#include <poll.h>
|
|
||||||
#include <sched.h>
|
|
||||||
#include <sys/dirent.h>
|
|
||||||
#include <sys/klog.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <sys/times.h>
|
|
||||||
#include <sys/uio.h>
|
|
||||||
#include <sys/utime.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
#include <sys/vfs.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#ifdef __i386__
|
|
||||||
# include <sys/vm86.h>
|
|
||||||
#endif
|
|
@ -39,7 +39,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "local.h"
|
#include "local.h"
|
||||||
#include "glue.h"
|
#include "glue.h"
|
||||||
#include "thread_private.h"
|
#include "private/thread_private.h"
|
||||||
|
|
||||||
int __sdidinit;
|
int __sdidinit;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "atexit.h"
|
#include "atexit.h"
|
||||||
#include "thread_private.h"
|
#include "private/thread_private.h"
|
||||||
|
|
||||||
int __atexit_invalid = 1;
|
int __atexit_invalid = 1;
|
||||||
struct atexit *__atexit;
|
struct atexit *__atexit;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "atexit.h"
|
#include "atexit.h"
|
||||||
#include "thread_private.h"
|
#include "private/thread_private.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This variable is zero until a process has created a thread.
|
* This variable is zero until a process has created a thread.
|
||||||
|
@ -38,7 +38,7 @@ static const char sccsid[] = "@(#)strftime.c 5.4 (Berkeley) 3/14/89";
|
|||||||
#include "locale.h"
|
#include "locale.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <time64.h>
|
#include <time64.h>
|
||||||
#include <bionic_time.h> /* for strftime_tz */
|
#include "private/bionic_time.h" /* for strftime_tz */
|
||||||
|
|
||||||
/* struct lc_time_T is now defined as strftime_locale
|
/* struct lc_time_T is now defined as strftime_locale
|
||||||
* in <time.h>
|
* in <time.h>
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "namespace.h"
|
#include "namespace.h"
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#include <arpa_nameser.h>
|
#include "private/arpa_nameser.h"
|
||||||
|
|
||||||
#define ISC_FORMAT_PRINTF(a,b) __printflike(a,b)
|
#define ISC_FORMAT_PRINTF(a,b) __printflike(a,b)
|
||||||
#define ISC_SOCKLEN_T socklen_t
|
#define ISC_SOCKLEN_T socklen_t
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/atomics.h>
|
#include <sys/atomics.h>
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#include <private/bionic_futex.h>
|
|
||||||
#include <private/bionic_atomic_inline.h>
|
#include "private/bionic_atomic_inline.h"
|
||||||
|
#include "private/bionic_futex.h"
|
||||||
|
|
||||||
// This file contains C++ ABI support functions for one time
|
// This file contains C++ ABI support functions for one time
|
||||||
// constructors as defined in the "Run-time ABI for the ARM Architecture"
|
// constructors as defined in the "Run-time ABI for the ARM Architecture"
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <bionic/pthread_internal.h>
|
#include <bionic/pthread_internal.h>
|
||||||
#include <private/bionic_tls.h>
|
#include "private/bionic_tls.h"
|
||||||
#include <private/ScopedPthreadMutexLocker.h>
|
#include "private/ScopedPthreadMutexLocker.h"
|
||||||
#include <private/ThreadLocalBuffer.h>
|
#include "private/ThreadLocalBuffer.h"
|
||||||
|
|
||||||
/* This file hijacks the symbols stubbed out in libdl.so. */
|
/* This file hijacks the symbols stubbed out in libdl.so. */
|
||||||
|
|
||||||
|
@ -40,9 +40,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
// Private C library headers.
|
// Private C library headers.
|
||||||
#include <private/bionic_tls.h>
|
#include "private/bionic_tls.h"
|
||||||
#include <private/KernelArgumentBlock.h>
|
#include "private/KernelArgumentBlock.h"
|
||||||
#include <private/ScopedPthreadMutexLocker.h>
|
#include "private/ScopedPthreadMutexLocker.h"
|
||||||
|
|
||||||
#include "linker.h"
|
#include "linker.h"
|
||||||
#include "linker_debug.h"
|
#include "linker_debug.h"
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <private/KernelArgumentBlock.h>
|
#include "private/KernelArgumentBlock.h"
|
||||||
|
|
||||||
static char** _envp;
|
static char** _envp;
|
||||||
static bool _AT_SECURE_value = true;
|
static bool _AT_SECURE_value = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user