Last change
on this file was 390, checked in by coas-nagasima, 5 years ago |
コードを整理
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
802 bytes
|
Rev | Line | |
---|
[388] | 1 | #include <stdlib.h>
|
---|
| 2 | #include <stdint.h>
|
---|
| 3 | #include "libc.h"
|
---|
| 4 |
|
---|
| 5 | static void dummy()
|
---|
| 6 | {
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | /* atexit.c and __stdio_exit.c override these. the latter is linked
|
---|
| 10 | * as a consequence of linking either __toread.c or __towrite.c. */
|
---|
| 11 | weak_alias(dummy, __funcs_on_exit);
|
---|
| 12 | weak_alias(dummy, __stdio_exit);
|
---|
| 13 | weak_alias(dummy, _fini);
|
---|
| 14 |
|
---|
| 15 | __attribute__((__weak__, __visibility__("hidden")))
|
---|
| 16 | extern void (*const __fini_array_start)(void), (*const __fini_array_end)(void);
|
---|
| 17 |
|
---|
| 18 | static void libc_exit_fini(void)
|
---|
| 19 | {
|
---|
| 20 | uintptr_t a = (uintptr_t)&__fini_array_end;
|
---|
| 21 | for (; a>(uintptr_t)&__fini_array_start; a-=sizeof(void(*)()))
|
---|
| 22 | (*(void (**)())(a-sizeof(void(*)())))();
|
---|
| 23 | _fini();
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | weak_alias(libc_exit_fini, __libc_exit_fini);
|
---|
| 27 |
|
---|
| 28 | _Noreturn void exit(int code)
|
---|
| 29 | {
|
---|
| 30 | __funcs_on_exit();
|
---|
| 31 | __libc_exit_fini();
|
---|
| 32 | __stdio_exit();
|
---|
| 33 | _Exit(code);
|
---|
| 34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.