Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge "Mark __BIONIC_WEAK_FOR_NATIVE_BRIDGE symbols"
Browse files Browse the repository at this point in the history
  • Loading branch information
Treehugger Robot authored and Gerrit Code Review committed Oct 27, 2017
2 parents 6bffdad + fa43252 commit dfece7a
Show file tree
Hide file tree
Showing 26 changed files with 114 additions and 4 deletions.
6 changes: 6 additions & 0 deletions libc/arch-arm/bionic/setjmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@
#define _JB_CHECKSUM (_JB_CORE_BASE+10)

ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
mov r1, #1
b sigsetjmp
END(setjmp)

ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
mov r1, #0
b sigsetjmp
END(_setjmp)
Expand Down Expand Up @@ -117,6 +119,7 @@ END(_setjmp)

// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
stmfd sp!, {r0, lr}
.cfi_def_cfa_offset 8
.cfi_rel_offset r0, 0
Expand Down Expand Up @@ -191,6 +194,7 @@ END(sigsetjmp)

// void siglongjmp(sigjmp_buf env, int value);
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
stmfd sp!, {r0, r1, lr}
.cfi_def_cfa_offset 12
.cfi_rel_offset r0, 0
Expand Down Expand Up @@ -262,4 +266,6 @@ ENTRY(siglongjmp)
END(siglongjmp)

ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
1 change: 1 addition & 0 deletions libc/arch-arm/bionic/vfork.S
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <private/bionic_asm.h>

ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
// __get_tls()[TLS_SLOT_THREAD_ID]->cached_pid_ = 0
mrc p15, 0, r3, c13, c0, 3
ldr r3, [r3, #4]
Expand Down
6 changes: 6 additions & 0 deletions libc/arch-arm64/bionic/setjmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,20 @@
.endm

ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
mov w1, #1
b sigsetjmp
END(setjmp)

ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
mov w1, #0
b sigsetjmp
END(_setjmp)

// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
stp x0, x30, [sp, #-16]!
.cfi_def_cfa_offset 16
.cfi_rel_offset x0, 0
Expand Down Expand Up @@ -178,6 +181,7 @@ END(sigsetjmp)

// void siglongjmp(sigjmp_buf env, int value);
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
#if USE_CHECKSUM
// Check the checksum before doing anything.
m_calculate_checksum x12, x0, x2
Expand Down Expand Up @@ -256,4 +260,6 @@ ENTRY(siglongjmp)
END(siglongjmp)

ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
1 change: 1 addition & 0 deletions libc/arch-arm64/bionic/vfork.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/sched.h>

ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
// __get_tls()[TLS_SLOT_THREAD_ID]->cached_pid_ = 0
mrs x0, tpidr_el0
ldr x0, [x0, #8]
Expand Down
6 changes: 6 additions & 0 deletions libc/arch-mips/bionic/setjmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ GPOFF= FRAMESZ-2*REGSZ
RAOFF= FRAMESZ-1*REGSZ

NON_LEAF(sigsetjmp, FRAMESZ, $ra)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
.mask 0x80000000, RAOFF
PTR_SUBU $sp, FRAMESZ # allocate stack frame
SETUP_GP64(GPOFF, sigsetjmp)
Expand Down Expand Up @@ -288,6 +289,7 @@ END(sigsetjmp)
# Alternate entry points:

NON_LEAF(setjmp, FRAMESZ, $ra)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
.mask 0x80000000, RAOFF
PTR_SUBU $sp, FRAMESZ
SETUP_GP64(GPOFF, setjmp) # can't share sigsetjmp's gp code
Expand All @@ -300,6 +302,7 @@ END(setjmp)


NON_LEAF(_setjmp, FRAMESZ, $ra)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
.mask 0x80000000, RAOFF
PTR_SUBU $sp, FRAMESZ
SETUP_GP64(GPOFF, _setjmp) # can't share sigsetjmp's gp code
Expand All @@ -312,6 +315,7 @@ END(_setjmp)


NON_LEAF(siglongjmp, FRAMESZ, $ra)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
.mask 0x80000000, RAOFF
PTR_SUBU $sp, FRAMESZ
SETUP_GP64(GPOFF, siglongjmp)
Expand Down Expand Up @@ -409,4 +413,6 @@ NON_LEAF(siglongjmp, FRAMESZ, $ra)
END(siglongjmp)

ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
1 change: 1 addition & 0 deletions libc/arch-mips/bionic/vfork.S
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define SIGCHLD 18

ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
.set noreorder
.cpload $t9

Expand Down
1 change: 1 addition & 0 deletions libc/arch-mips64/bionic/vfork.S
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ FRAMESZ = MKFSIZ(0,0)
#endif

LEAF(vfork,FRAMESZ)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
#if FRAMESZ!=0
PTR_SUBU $sp, FRAMESZ
#endif
Expand Down
6 changes: 6 additions & 0 deletions libc/arch-x86/bionic/setjmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,21 @@
.endm

ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
movl 4(%esp),%ecx
mov $1,%eax
jmp .L_sigsetjmp
END(setjmp)

ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
movl 4(%esp),%ecx
movl $0,%eax
jmp .L_sigsetjmp
END(_setjmp)

ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
movl 4(%esp),%ecx
movl 8(%esp),%eax

Expand Down Expand Up @@ -142,6 +145,7 @@ ENTRY(sigsetjmp)
END(sigsetjmp)

ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
movl 4(%esp),%edx

// Check the checksum before doing anything.
Expand Down Expand Up @@ -205,4 +209,6 @@ ENTRY(siglongjmp)
END(siglongjmp)

ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
1 change: 1 addition & 0 deletions libc/arch-x86/bionic/vfork.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
// This custom code preserves the return address across the system call.

ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
popl %ecx // Grab the return address.
.cfi_adjust_cfa_offset 4
.cfi_rel_offset ecx, 0
Expand Down
6 changes: 6 additions & 0 deletions libc/arch-x86_64/bionic/setjmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,20 @@
.endm

ENTRY(setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(setjmp)
movl $1,%esi
jmp PIC_PLT(sigsetjmp)
END(setjmp)

ENTRY(_setjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_setjmp)
movl $0,%esi
jmp PIC_PLT(sigsetjmp)
END(_setjmp)

// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
pushq %rdi
movq %rsi,%rdi
call PIC_PLT(__bionic_setjmp_cookie_get)
Expand Down Expand Up @@ -148,6 +151,7 @@ END(sigsetjmp)

// void siglongjmp(sigjmp_buf env, int value);
ENTRY(siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(siglongjmp)
movq %rdi,%r12
pushq %rsi // Push 'value'.

Expand Down Expand Up @@ -206,4 +210,6 @@ ENTRY(siglongjmp)
END(siglongjmp)

ALIAS_SYMBOL(longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(longjmp)
ALIAS_SYMBOL(_longjmp, siglongjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(_longjmp)
1 change: 1 addition & 0 deletions libc/arch-x86_64/bionic/vfork.S
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
// This custom code preserves the return address across the system call.

ENTRY(vfork)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(vfork)
popq %rdi // Grab the return address.

// __get_tls()[TLS_SLOT_THREAD_ID]->cached_pid_ = 0
Expand Down
7 changes: 6 additions & 1 deletion libc/bionic/__cxa_thread_atexit_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
#include <sys/cdefs.h>

#include <private/bionic_defs.h>

#include "pthread_internal.h"

class thread_local_dtor {
Expand All @@ -25,7 +27,10 @@ class thread_local_dtor {
thread_local_dtor* next;
};

extern "C" int __cxa_thread_atexit_impl(void (*func) (void *), void *arg, void *dso_handle) {
extern "C" int __cxa_thread_atexit_impl(void (*func) (void *), void *arg, void *dso_handle);

__BIONIC_WEAK_FOR_NATIVE_BRIDGE
int __cxa_thread_atexit_impl(void (*func) (void *), void *arg, void *dso_handle) {
thread_local_dtor* dtor = new thread_local_dtor();

dtor->func = func;
Expand Down
8 changes: 5 additions & 3 deletions libc/bionic/clone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "pthread_internal.h"

#include "private/bionic_defs.h"
#include "private/bionic_macros.h"

extern "C" pid_t __bionic_clone(uint32_t flags, void* child_stack, int* parent_tid, void* tls, int* child_tid, int (*fn)(void*), void* arg);
Expand All @@ -52,10 +53,11 @@ extern "C" __LIBC_HIDDEN__ void __start_thread(int (*fn)(void*), void* arg) {
__exit(status);
}

__BIONIC_WEAK_FOR_NATIVE_BRIDGE
int clone(int (*fn)(void*), void* child_stack, int flags, void* arg, ...) {
int* parent_tid = NULL;
void* new_tls = NULL;
int* child_tid = NULL;
int* parent_tid = nullptr;
void* new_tls = nullptr;
int* child_tid = nullptr;

if (fn != nullptr && child_stack == nullptr) {
errno = EINVAL;
Expand Down
2 changes: 2 additions & 0 deletions libc/bionic/environ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <unistd.h>

#include "private/bionic_defs.h"
// Keep that variable in separate .o file to make sure programs which define
// their own "environ" are compileable.
__BIONIC_WEAK_VARIABLE_FOR_NATIVE_BRIDGE
char** environ;
2 changes: 2 additions & 0 deletions libc/bionic/fork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@

#include <unistd.h>

#include "private/bionic_defs.h"
#include "pthread_internal.h"

__BIONIC_WEAK_FOR_NATIVE_BRIDGE
int fork() {
__bionic_atfork_run_prepare();

Expand Down
Loading

0 comments on commit dfece7a

Please # to comment.