1 /* Copyright (C) 1991,92,93,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3 
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
17 
18 #ifndef _LIBC_INTERNAL_H
19 #define _LIBC_INTERNAL_H 1
20 
21 #include <features.h>
22 
23 #ifdef __UCLIBC_BUILD_RELRO__
24 # define attribute_relro __attribute__ ((section (".data.rel.ro")))
25 #else
26 # define attribute_relro
27 #endif
28 
29 #ifdef __UCLIBC_HAS_TLS__
30 # define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
31 #else
32 # define attribute_tls_model_ie
33 # define __thread
34 #endif
35 
36 /* Pull in things like __attribute_used__ */
37 #include <sys/cdefs.h>
38 
39 /* --- this is added to integrate linuxthreads */
40 /*#define __USE_UNIX98            1*/
41 
42 #ifndef __ASSEMBLER__
43 # ifdef IS_IN_libc
44 
45 #  define __need_size_t
46 #  include <stddef.h>
47 
48 /* sources are built w/ _GNU_SOURCE, this gets undefined */
49 #if defined __USE_XOPEN2K && !defined  __USE_GNU
50 extern char *__glibc_strerror_r (int __errnum, char *__buf, size_t __buflen);
51 libc_hidden_proto(__glibc_strerror_r)
52 #else
53 extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
54 libc_hidden_proto(__xpg_strerror_r)
55 #endif
56 
57 /* #include <pthread.h> */
58 #  ifndef __UCLIBC_HAS_THREADS__
59 #   define __pthread_mutex_init(mutex, mutexattr)         ((void)0)
60 #   define __pthread_mutex_lock(mutex)                    ((void)0)
61 #   define __pthread_mutex_trylock(mutex)                 ((void)0)
62 #   define __pthread_mutex_unlock(mutex)                  ((void)0)
63 #   define _pthread_cleanup_push_defer(mutex)             ((void)0)
64 #   define _pthread_cleanup_pop_restore(mutex)            ((void)0)
65 #  endif
66 
67 /* internal access to program name */
68 extern const char *__uclibc_progname attribute_hidden;
69 
70 #  ifdef __UCLIBC_HAS_FORTIFY__
71 extern void __chk_fail(void) attribute_noreturn;
72 libc_hidden_proto(__chk_fail)
73 #  endif
74 
75 #  ifdef __UCLIBC_HAS_SSP__
76 extern void __stack_chk_fail(void) attribute_noreturn __cold;
77 #  endif
78 
79 # endif /* IS_IN_libc */
80 
81 #endif /* __ASSEMBLER__ */
82 
83 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
84 
85 /* Some people like to build up uClibc with *-elf toolchains, so
86  * a little grease here until we drop '#ifdef __linux__' checks
87  * from our source code.
88  */
89 #ifndef __linux__
90 # define __linux__ 1
91 #endif
92 
93 #endif /* _LIBC_INTERNAL_H */
94