OSDN Git Service

The weak_alias macro was not genertaing asm with the correct alias names.
[uclinux-h8/uClibc.git] / include / features.h
1 #ifndef __FEATURES_H
2 #define __FEATURES_H
3
4
5 /* Major and minor version number of the uClibc library package.  Use
6    these macros to test for features in specific releases.  */
7 #define __UCLIBC__              0
8 #define __UCLIBC_MAJOR__        9
9 #define __UCLIBC_MINOR__        5
10
11 /*  There is an unwholesomely huge amount of code out there that depends on the
12  *  presence of GNU libc header files.  We have GNU libc header files.  So here
13  *  we commit a horrible sin.  At this point, we _lie_ and claim to be GNU libc
14  *  to make things like /usr/include/linux/socket.h and lots of apps work as
15  *  their developers intended.  This is IMHO, pardonable, since these defines
16  *  are not really intended to check for the presence of a particular library,
17  *  but rather are used to define an _interface_.  */
18 #if !defined _LIBC || defined __FORCE_GLIBC__ 
19 #   define __GNU_LIBRARY__ 6
20 #   define __GLIBC__       2
21 #   define __GLIBC_MINOR__ 1
22 #endif  
23
24 /* Make a half-hearted attempt to accomodate non-gcc compilers */
25 #ifndef __GNUC__
26 #define __attribute(foo)  /* Ignore */
27 #endif
28
29 /* Convenience macro to test the version of gcc.
30  * Use it like this:
31  * #if __GNUC_PREREQ (2,8)
32  * ... code requiring gcc 2.8 or later ...
33  * #endif
34  * Note - they won't work for gcc1, since the _MINOR macros
35  * were not defined then. */
36 #if defined __GNUC__ && defined __GNUC_MINOR__
37 #define __GNUC_PREREQ(maj, min) \
38         ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
39 #else
40 #define __GNUC_PREREQ(maj,min) 0
41 #endif
42
43 /* __restrict is known in EGCS 1.2 and above. */
44 #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 92)
45 # define __restrict     /* Ignore */
46 #endif
47
48 /* __extension__ is known in gcc 2.8 above. */
49 #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
50 # define __extension__     /* Ignore */
51 #endif
52
53 #ifdef __STDC__
54
55 #define __P(x)      x
56 #define __PMT(x)    x
57 #ifndef __const
58 #define __const const
59 #endif
60
61 /* Almost ansi */
62 #if __STDC__ != 1
63 #ifndef const
64 #define const
65 #endif
66 #define volatile
67 #endif
68
69 #else /* K&R */
70
71 #define __P(x) ()
72 #ifndef __const
73 #define __const
74 #endif
75 #ifndef const
76 #define const
77 #endif
78 #define volatile
79
80 #endif
81
82 /* GNUish things */
83 #define __CONSTVALUE
84 #define __CONSTVALUE2
85
86 #define __USE_BSD
87 #define __USE_MISC
88 #define __USE_POSIX
89 #define __USE_POSIX2
90 #define __USE_XOPEN
91
92 #undef  __KERNEL_STRICT_NAMES
93 #ifndef _LOOSE_KERNEL_NAMES
94 # define __KERNEL_STRICT_NAMES
95 #endif
96
97 #ifdef  _GNU_SOURCE
98 # define __USE_GNU      1
99 #endif
100
101 #include <sys/cdefs.h>
102
103 #define __need_uClibc_config_h
104 #include <bits/uClibc_config.h>
105 #undef __need_uClibc_config_h
106
107
108 /* Some nice features only work properly with ELF */
109 #if defined HAVE_ELF    
110 #   define link_warning(symbol, msg) \
111         asm (".section "  ".gnu.warning." #symbol  "\n\t.previous");  \
112             static const char __evoke_link_warning_##symbol[]     \
113             __attribute__ ((section (".gnu.warning." #symbol "\n\t#"))) = msg;
114 #   define weak_alias(name, aliasname) \
115         asm(".global " #name ";.weak " #aliasname ";" #aliasname "=" #name ";");
116 #else
117 #   define link_warning(symbol, msg) \
118         asm (".stabs \"" msg "\",30,0,0,0\n\t" \
119               ".stabs \"" #symbol "\",1,0,0,0\n");
120 #   define weak_alias(name, aliasname) \
121         __asm__(".global alias\n.set alias,original");
122 #endif
123
124
125 #endif
126