chiark / gitweb /
volume_id: provide libvolume_id.a file
[elogind.git] / klibc / klibc / arch / x86_64 / exits.S
1 #
2 # exit and _exit get included in *every* program, and gcc generates
3 # horrible code for them.  Yes, this only saves a few bytes, but
4 # it does it in every program.
5 #
6
7 #include <asm/unistd.h>
8
9         .data
10         .align 8
11         .globl __exit_handler
12         .type __exit_handler,@object
13 __exit_handler:
14         .quad _exit
15         .size __exit_handler,8
16
17         .text
18         .align 8
19         .globl exit
20         .type exit,@function
21 exit:
22         jmp *(__exit_handler)
23         .size exit,.-exit
24
25         /* No need to save any registers... we're exiting! */
26         .text
27         .align 4
28         .globl _exit
29         .type _exit,@function
30 _exit:
31         movl $__NR_exit,%eax
32         /* The argument is already in %rdi */
33         syscall
34         .size _exit,.-exit
35