OSDN Git Service

add optional global visibility override
[android-x86/external-musl-libc.git] / src / internal / vis.h
1 /* This file is only used if enabled in the build system, in which case it is
2  * included automatically via command line options. It is not included
3  * explicitly by any source files or other headers. Its purpose is to
4  * override default visibilities to reduce the size and performance costs
5  * of position-independent code. */
6
7 #ifndef CRT
8 #ifdef SHARED
9
10 /* For shared libc.so, all symbols should be protected, but some toolchains
11  * fail to support copy relocations for protected data, so exclude all
12  * exported data symbols. */
13
14 __attribute__((__visibility__("default")))
15 extern struct _IO_FILE *const stdin, *const stdout, *const stderr;
16
17 __attribute__((__visibility__("default")))
18 extern int optind, opterr, optopt, optreset, __optreset, getdate_err, h_errno, daylight, __daylight, signgam, __signgam;
19
20 __attribute__((__visibility__("default")))
21 extern long timezone, __timezone;
22
23 __attribute__((__visibility__("default")))
24 extern char *optarg, **environ, **__environ, *tzname[2], *__tzname[2], *__progname, *__progname_full;
25
26 #pragma GCC visibility push(protected)
27
28 #elif defined(__PIC__)
29
30 /* If building static libc.a as position-independent code, try to make
31  * everything hidden except possibly-undefined weak references. */
32
33 __attribute__((__visibility__("default")))
34 extern void (*const __init_array_start)(), (*const __init_array_end)(),
35         (*const __fini_array_start)(), (*const __fini_array_end)();
36
37 #pragma GCC visibility push(hidden)
38
39 #endif
40 #endif