Fix the exit syscall stub's name.

I've left the exit_group syscall as _exit because otherwise we'd have to
convince the compiler that our _exit (which just calls __exit_group) is
actually "noreturn", and it seems like that would be less clean than just
cutting out the middleman.

We'll just have to trust ourselves not to add anything to SYSCALLS.TXT
that ought to be private but that only has a single leading underscore.
Hopefully we can manage that.

Change-Id: Iac47faea9f516186e1774381846c54cafabc4354
This commit is contained in:
Elliott Hughes 2013-10-24 22:36:58 -07:00
parent bbefbf1a75
commit 6b53c2349a
12 changed files with 25 additions and 26 deletions

View File

@ -24,13 +24,6 @@
#
# This file is processed by a python script named gensyscalls.py.
# process management
void _exit:exit_group(int) all
void _exit_thread:exit(int) all
pid_t wait4(pid_t, int*, int, struct rusage*) all
int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*) all
int execve(const char*, char* const*, char* const*) all
uid_t getuid:getuid32() arm,x86
@ -289,6 +282,9 @@ int __epoll_pwait:epoll_pwait(int, struct epoll_event*, int, int, const sigset_t
int eventfd:eventfd2(unsigned int, int) all
void _exit:exit_group(int) all
void __exit:exit(int) all
int futex(void*, int, int, void*, void*, int) all
int inotify_init1(int) all
@ -298,6 +294,9 @@ int inotify_rm_watch(int, unsigned int) all
int __pselect6:pselect6(int, fd_set*, fd_set*, fd_set*, timespec*, void*) all
int __ppoll:ppoll(pollfd*, unsigned int, timespec*, const sigset_t*, size_t) all
pid_t wait4(pid_t, int*, int, struct rusage*) all
int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*) all
# ARM-specific
int __set_tls:__ARM_NR_set_tls(void*) arm
int cacheflush:__ARM_NR_cacheflush(long start, long end, long flags) arm

View File

@ -3,6 +3,7 @@ syscall_src :=
syscall_src += arch-arm/syscalls/__brk.S
syscall_src += arch-arm/syscalls/__clone.S
syscall_src += arch-arm/syscalls/__epoll_pwait.S
syscall_src += arch-arm/syscalls/__exit.S
syscall_src += arch-arm/syscalls/__fcntl.S
syscall_src += arch-arm/syscalls/__fcntl64.S
syscall_src += arch-arm/syscalls/__fstatfs64.S
@ -34,7 +35,6 @@ syscall_src += arch-arm/syscalls/__timer_gettime.S
syscall_src += arch-arm/syscalls/__timer_settime.S
syscall_src += arch-arm/syscalls/__waitid.S
syscall_src += arch-arm/syscalls/_exit.S
syscall_src += arch-arm/syscalls/_exit_thread.S
syscall_src += arch-arm/syscalls/accept.S
syscall_src += arch-arm/syscalls/acct.S
syscall_src += arch-arm/syscalls/bind.S

View File

@ -4,7 +4,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(_exit_thread)
ENTRY(__exit)
mov ip, r7
ldr r7, =__NR_exit
swi #0
@ -13,4 +13,4 @@ ENTRY(_exit_thread)
bxls lr
neg r0, r0
b __set_errno
END(_exit_thread)
END(__exit)

View File

@ -3,6 +3,7 @@ syscall_src :=
syscall_src += arch-mips/syscalls/__brk.S
syscall_src += arch-mips/syscalls/__clone.S
syscall_src += arch-mips/syscalls/__epoll_pwait.S
syscall_src += arch-mips/syscalls/__exit.S
syscall_src += arch-mips/syscalls/__fcntl.S
syscall_src += arch-mips/syscalls/__fcntl64.S
syscall_src += arch-mips/syscalls/__fstatfs64.S
@ -34,7 +35,6 @@ syscall_src += arch-mips/syscalls/__timer_gettime.S
syscall_src += arch-mips/syscalls/__timer_settime.S
syscall_src += arch-mips/syscalls/__waitid.S
syscall_src += arch-mips/syscalls/_exit.S
syscall_src += arch-mips/syscalls/_exit_thread.S
syscall_src += arch-mips/syscalls/_flush_cache.S
syscall_src += arch-mips/syscalls/accept.S
syscall_src += arch-mips/syscalls/acct.S

View File

@ -2,11 +2,11 @@
#include <asm/unistd.h>
.text
.globl _exit_thread
.globl __exit
.align 4
.ent _exit_thread
.ent __exit
_exit_thread:
__exit:
.set noreorder
.cpload $t9
li $v0, __NR_exit
@ -20,4 +20,4 @@ _exit_thread:
j $t9
nop
.set reorder
.end _exit_thread
.end __exit

View File

@ -3,6 +3,7 @@ syscall_src :=
syscall_src += arch-x86/syscalls/__brk.S
syscall_src += arch-x86/syscalls/__clone.S
syscall_src += arch-x86/syscalls/__epoll_pwait.S
syscall_src += arch-x86/syscalls/__exit.S
syscall_src += arch-x86/syscalls/__fcntl.S
syscall_src += arch-x86/syscalls/__fcntl64.S
syscall_src += arch-x86/syscalls/__fstatfs64.S
@ -34,7 +35,6 @@ syscall_src += arch-x86/syscalls/__timer_gettime.S
syscall_src += arch-x86/syscalls/__timer_settime.S
syscall_src += arch-x86/syscalls/__waitid.S
syscall_src += arch-x86/syscalls/_exit.S
syscall_src += arch-x86/syscalls/_exit_thread.S
syscall_src += arch-x86/syscalls/accept.S
syscall_src += arch-x86/syscalls/acct.S
syscall_src += arch-x86/syscalls/bind.S

View File

@ -4,7 +4,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(_exit_thread)
ENTRY(__exit)
pushl %ebx
mov 8(%esp), %ebx
movl $__NR_exit, %eax
@ -19,4 +19,4 @@ ENTRY(_exit_thread)
1:
popl %ebx
ret
END(_exit_thread)
END(__exit)

View File

@ -4,6 +4,7 @@ syscall_src += arch-x86_64/syscalls/__arch_prctl.S
syscall_src += arch-x86_64/syscalls/__brk.S
syscall_src += arch-x86_64/syscalls/__clone.S
syscall_src += arch-x86_64/syscalls/__epoll_pwait.S
syscall_src += arch-x86_64/syscalls/__exit.S
syscall_src += arch-x86_64/syscalls/__getcpu.S
syscall_src += arch-x86_64/syscalls/__getcwd.S
syscall_src += arch-x86_64/syscalls/__getpriority.S
@ -27,7 +28,6 @@ syscall_src += arch-x86_64/syscalls/__timer_gettime.S
syscall_src += arch-x86_64/syscalls/__timer_settime.S
syscall_src += arch-x86_64/syscalls/__waitid.S
syscall_src += arch-x86_64/syscalls/_exit.S
syscall_src += arch-x86_64/syscalls/_exit_thread.S
syscall_src += arch-x86_64/syscalls/accept.S
syscall_src += arch-x86_64/syscalls/acct.S
syscall_src += arch-x86_64/syscalls/bind.S

View File

@ -4,7 +4,7 @@
#include <linux/err.h>
#include <machine/asm.h>
ENTRY(_exit_thread)
ENTRY(__exit)
movl $__NR_exit, %eax
syscall
cmpq $-MAX_ERRNO, %rax
@ -15,4 +15,5 @@ ENTRY(_exit_thread)
orq $-1, %rax
1:
ret
END(_exit_thread)
END(__exit)
.hidden _C_LABEL(__exit)

View File

@ -39,14 +39,14 @@ extern int __bionic_clone(unsigned long clone_flags,
int (*fn)(void *),
void *arg);
extern void _exit_thread(int status);
extern void __exit(int status);
/* this function is called from the __bionic_clone
* assembly fragment to call the thread function
* then exit. */
extern void __bionic_clone_entry(int (*fn)(void*), void* arg) {
int status = (*fn)(arg);
_exit_thread(status);
__exit(status);
}
int clone(int (*fn)(void*), void* child_stack, int flags, void* arg, ...) {

View File

@ -46,7 +46,7 @@ extern void pthread_debug_mutex_lock_check(pthread_mutex_t *mutex);
extern void pthread_debug_mutex_unlock_check(pthread_mutex_t *mutex);
extern void _exit_with_stack_teardown(void * stackBase, size_t stackSize, int status);
extern void _exit_thread(int status);
extern void __exit(int status);
int __futex_wake_ex(volatile void *ftx, int pshared, int val)
{
@ -148,7 +148,7 @@ void pthread_exit(void * retval)
if (user_stack) {
// Cleaning up this thread's stack is the creator's responsibility, not ours.
_exit_thread(0);
__exit(0);
} else {
// We need to munmap the stack we're running on before calling exit.
// That's not something we can do in C.

View File

@ -240,7 +240,6 @@ def add_footer(pointer_length, stub, syscall):
stub += function_alias % { "func" : syscall["func"], "alias" : alias }
# Use hidden visibility for any functions beginning with underscores.
# TODO: clean up single-underscore names too.
if pointer_length == 64 and syscall["func"].startswith("__"):
stub += '.hidden _C_LABEL(' + syscall["func"] + ')\n'