Last change
on this file since 373 was 352, checked in by coas-nagasima, 6 years ago |
arm向けASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
996 bytes
|
Line | |
---|
1 | #include <stdlib.h>
|
---|
2 | #include <stdint.h>
|
---|
3 | #include "libc.h"
|
---|
4 |
|
---|
5 | #ifndef __c2__
|
---|
6 | static void dummy()
|
---|
7 | {
|
---|
8 | }
|
---|
9 |
|
---|
10 | /* atexit.c and __stdio_exit.c override these. the latter is linked
|
---|
11 | * as a consequence of linking either __toread.c or __towrite.c. */
|
---|
12 | weak_alias(dummy, __funcs_on_exit);
|
---|
13 | weak_alias(dummy, __stdio_exit);
|
---|
14 | weak_alias(dummy, _fini);
|
---|
15 | #else
|
---|
16 | __attribute__((weak))
|
---|
17 | void __funcs_on_exit() { }
|
---|
18 | void __stdio_exit();
|
---|
19 | __attribute__((weak))
|
---|
20 | void _fini() { }
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | __attribute__((__weak__, __visibility__("hidden")))
|
---|
24 | extern void (*const __fini_array_start)(void), (*const __fini_array_end)(void);
|
---|
25 |
|
---|
26 | static void libc_exit_fini(void)
|
---|
27 | {
|
---|
28 | uintptr_t a = (uintptr_t)&__fini_array_end;
|
---|
29 | for (; a>(uintptr_t)&__fini_array_start; a-=sizeof(void(*)()))
|
---|
30 | (*(void (**)())(a-sizeof(void(*)())))();
|
---|
31 | _fini();
|
---|
32 | }
|
---|
33 |
|
---|
34 | #ifndef __c2__
|
---|
35 | weak_alias(libc_exit_fini, __libc_exit_fini);
|
---|
36 | #else
|
---|
37 | void __libc_exit_fini(void);
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | _Noreturn void exit(int code)
|
---|
41 | {
|
---|
42 | __funcs_on_exit();
|
---|
43 | __libc_exit_fini();
|
---|
44 | __stdio_exit();
|
---|
45 | _Exit(code);
|
---|
46 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.