OSDN Git Service

Config.in.arch: enable long double math for xtensa
[uclinux-h8/uClibc.git] / include / libc-symbols.h
1 /* Support macros for making weak and strong aliases for symbols,
2    and for using symbol sets and linker warnings with GNU ld.
3    Copyright (C) 1995-1998,2000-2003,2004,2005,2006
4         Free Software Foundation, Inc.
5    This file is part of the GNU C Library.
6
7    The GNU C Library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Lesser General Public
9    License as published by the Free Software Foundation; either
10    version 2.1 of the License, or (at your option) any later version.
11
12    The GNU C Library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
16
17    You should have received a copy of the GNU Lesser General Public
18    License along with the GNU C Library; if not, see
19    <http://www.gnu.org/licenses/>.  */
20
21 #ifndef _LIBC_SYMBOLS_H
22 #define _LIBC_SYMBOLS_H 1
23
24 /* This is defined for the compilation of all C library code.  features.h
25    tests this to avoid inclusion of stubs.h while compiling the library,
26    before stubs.h has been generated.  Some library code that is shared
27    with other packages also tests this symbol to see if it is being
28    compiled as part of the C library.  We must define this before including
29    config.h, because it makes some definitions conditional on whether libc
30    itself is being compiled, or just some generator program.  */
31 #define _LIBC   1
32
33
34 /* This file's macros are included implicitly in the compilation of every
35    file in the C library by -imacros.
36
37    We include uClibc_arch_features.h which is defined by arch devs.
38    It should define for us the following symbols:
39
40    * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
41    * ASM_GLOBAL_DIRECTIVE with `.globl' or `.global'.
42    * ASM_TYPE_DIRECTIVE_PREFIX with `@' or `#' or whatever for .type,
43      or leave it undefined if there is no .type directive.
44    * HAVE_ELF if using ELF, which supports weak symbols using `.weak'.
45    * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'.
46    * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'.
47
48    */
49
50 #include <bits/uClibc_arch_features.h>
51
52 /* Enable declarations of GNU extensions, since we are compiling them.  */
53 #define _GNU_SOURCE     1
54
55 /* Prepare for the case that `__builtin_expect' is not available.  */
56 #if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ < 96
57 # define __builtin_expect(x, expected_value) (x)
58 #endif
59 #ifndef likely
60 # define likely(x)      __builtin_expect((!!(x)),1)
61 #endif
62 #ifndef unlikely
63 # define unlikely(x)    __builtin_expect((!!(x)),0)
64 #endif
65 #if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
66 # ifndef __cold
67 #  define __cold __attribute__ ((__cold__))
68 # endif
69 # ifndef __hot
70 #  define __hot __attribute__ ((__hot__))
71 # endif
72 #else
73 # ifndef __cold
74 #  define __cold
75 # endif
76 # ifndef __hot
77 #  define __hot
78 # endif
79 #endif
80 #ifndef __LINUX_COMPILER_H
81 # define __LINUX_COMPILER_H
82 #endif
83 #ifndef __cast__
84 # define __cast__(_to)
85 #endif
86
87 #if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
88 # define attribute_optimize(x) __attribute__ ((optimize(x)))
89 #else
90 # define attribute_optimize(x)
91 #endif
92
93 #define attribute_unused __attribute__ ((unused))
94
95 #if defined __GNUC__ || defined __ICC
96 # define attribute_noreturn __attribute__ ((__noreturn__))
97 #else
98 # define attribute_noreturn
99 #endif
100
101 #define libc_freeres_ptr(decl) \
102       __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
103   decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
104 #define __libc_freeres_fn_section \
105       __attribute__ ((section ("__libc_freeres_fn")))
106
107 #ifndef NOT_IN_libc
108 # define IS_IN_libc 1
109 #endif
110
111 /* Indirect stringification.  Doing two levels allows
112  * the parameter to be a macro itself.
113  */
114 #define __stringify_1(x)    #x
115 #define __stringify(x)      __stringify_1(x)
116
117 #ifdef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
118 # define HAVE_ASM_SET_DIRECTIVE
119 #else
120 # undef HAVE_ASM_SET_DIRECTIVE
121 #endif
122
123 #ifdef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
124 # define ASM_GLOBAL_DIRECTIVE __UCLIBC_ASM_GLOBAL_DIRECTIVE__
125 #else
126 # define ASM_GLOBAL_DIRECTIVE .global
127 #endif
128
129 #ifdef __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
130 # define HAVE_ASM_WEAK_DIRECTIVE
131 #else
132 # undef HAVE_ASM_WEAK_DIRECTIVE
133 #endif
134
135 #ifdef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
136 # define HAVE_ASM_WEAKEXT_DIRECTIVE
137 #else
138 # undef HAVE_ASM_WEAKEXT_DIRECTIVE
139 #endif
140
141 #ifdef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
142 # define HAVE_ASM_GLOBAL_DOT_NAME
143 #else
144 # undef HAVE_ASM_GLOBAL_DOT_NAME
145 #endif
146
147 #ifdef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__
148 # define HAVE_ASM_CFI_DIRECTIVES
149 #else
150 # undef HAVE_ASM_CFI_DIRECTIVES
151 #endif
152
153 #if defined HAVE_ASM_WEAK_DIRECTIVE || defined HAVE_ASM_WEAKEXT_DIRECTIVE
154 # define HAVE_WEAK_SYMBOLS
155 #endif
156
157 #undef C_SYMBOL_NAME
158 #ifndef C_SYMBOL_NAME
159 # ifndef __UCLIBC_UNDERSCORES__
160 #  define C_SYMBOL_NAME(name) name
161 # else
162 #  define C_SYMBOL_NAME(name) _##name
163 # endif
164 #endif
165
166 #ifdef __UCLIBC_ASM_LINE_SEP__
167 # define ASM_LINE_SEP __UCLIBC_ASM_LINE_SEP__
168 #else
169 # define ASM_LINE_SEP ;
170 #endif
171
172 #ifdef HAVE_ASM_GLOBAL_DOT_NAME
173 # ifndef C_SYMBOL_DOT_NAME
174 #  if defined __GNUC__ && defined __GNUC_MINOR__ \
175       && (__GNUC__ << 16) + __GNUC_MINOR__ >= (3 << 16) + 1
176 #   define C_SYMBOL_DOT_NAME(name) .name
177 #  else
178 #   define C_SYMBOL_DOT_NAME(name) .##name
179 #  endif
180 # endif
181 #endif
182
183 #ifndef __ASSEMBLER__
184 /* GCC understands weak symbols and aliases; use its interface where
185    possible, instead of embedded assembly language.  */
186
187 /* Define ALIASNAME as a strong alias for NAME.  */
188 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
189 # define _strong_alias(name, aliasname) \
190   extern __typeof (name) aliasname __attribute__ ((alias (#name)));
191 /* Same, but does not check for type match. Use sparingly.
192    Example: strong_alias(stat,stat64) may fail, this one works: */
193 # define strong_alias_untyped(name, aliasname) \
194   _strong_alias_untyped(name, aliasname)
195 # define _strong_alias_untyped(name, aliasname) \
196   extern __typeof (aliasname) aliasname __attribute__ ((alias (#name)));
197
198 # ifdef HAVE_WEAK_SYMBOLS
199
200 /* This comes between the return type and function name in
201    a function definition to make that definition weak.  */
202 #  define weak_function __attribute__ ((weak))
203 #  define weak_const_function __attribute__ ((weak, __const__))
204
205 /* Define ALIASNAME as a weak alias for NAME.
206    If weak aliases are not available, this defines a strong alias.  */
207 #  define weak_alias(name, aliasname) _weak_alias (name, aliasname)
208 #  define _weak_alias(name, aliasname) \
209   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
210
211 /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined).  */
212 #  define weak_extern(symbol) _weak_extern (weak symbol)
213 #  define _weak_extern(expr) _Pragma (#expr)
214
215 # else
216
217 #  define weak_function /* empty */
218 #  define weak_const_function __attribute__ ((__const__))
219
220 #  define weak_alias(name, aliasname) strong_alias(name, aliasname)
221 #  define weak_extern(symbol) /* Nothing. */
222
223 # endif
224
225 #else /* __ASSEMBLER__ */
226
227 # ifdef HAVE_ASM_SET_DIRECTIVE
228 #  ifdef HAVE_ASM_GLOBAL_DOT_NAME
229 #   define strong_alias(original, alias) \
230         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
231         .set    C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)    ASM_LINE_SEP \
232         ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME(alias)           ASM_LINE_SEP \
233         .set    C_SYMBOL_DOT_NAME(alias),C_SYMBOL_DOT_NAME(original)
234 #   define strong_data_alias(original, alias) \
235         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
236         .set    C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
237 #  else
238 #   define strong_alias(original, alias) \
239         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
240         .set    C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
241 #   define strong_data_alias(original, alias) strong_alias(original, alias)
242 #  endif
243 # else
244 #  ifdef HAVE_ASM_GLOBAL_DOT_NAME
245 #   define strong_alias(original, alias) \
246         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
247         C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)          ASM_LINE_SEP \
248         ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME(alias)           ASM_LINE_SEP \
249         C_SYMBOL_DOT_NAME(alias) = C_SYMBOL_DOT_NAME(original)
250 #   define strong_data_alias(original, alias) \
251         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
252         C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)
253 #  else
254 #   define strong_alias(original, alias) \
255         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
256         C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)
257 #   define strong_data_alias(original, alias) strong_alias(original, alias)
258 #  endif
259 # endif
260
261 # ifdef HAVE_WEAK_SYMBOLS
262 #  ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
263 #   ifdef HAVE_ASM_GLOBAL_DOT_NAME
264 #    define weak_alias(original, alias) \
265         .weakext C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)   ASM_LINE_SEP \
266         .weakext C_SYMBOL_DOT_NAME(alias),C_SYMBOL_DOT_NAME(original)
267 #   else
268 #    define weak_alias(original, alias) \
269         .weakext C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
270 #   endif
271 #   define weak_extern(symbol) \
272         .weakext C_SYMBOL_NAME(symbol)
273
274 #  else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
275
276 #   ifdef HAVE_ASM_SET_DIRECTIVE
277 #    ifdef HAVE_ASM_GLOBAL_DOT_NAME
278 #     define weak_alias(original, alias) \
279         .weak   C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
280         .set    C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)    ASM_LINE_SEP \
281         .weak   C_SYMBOL_DOT_NAME(alias)                        ASM_LINE_SEP \
282         .set    C_SYMBOL_DOT_NAME(alias),C_SYMBOL_DOT_NAME(original)
283 #    else
284 #     define weak_alias(original, alias) \
285         .weak   C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
286         .set    C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
287 #    endif
288 #   else /* ! HAVE_ASM_SET_DIRECTIVE */
289 #    ifdef HAVE_ASM_GLOBAL_DOT_NAME
290 #     define weak_alias(original, alias) \
291         .weak   C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
292         C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)          ASM_LINE_SEP \
293         .weak   C_SYMBOL_DOT_NAME(alias)                        ASM_LINE_SEP \
294         C_SYMBOL_DOT_NAME(alias) = C_SYMBOL_DOT_NAME(original)
295 #    else
296 #     define weak_alias(original, alias) \
297         .weak   C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
298         C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)
299 #    endif
300 #   endif
301 #   define weak_extern(symbol) \
302         .weak   C_SYMBOL_NAME(symbol)
303
304 #  endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
305
306 # else /* ! HAVE_WEAK_SYMBOLS */
307
308 #  define weak_alias(original, alias) strong_alias(original, alias)
309 #  define weak_extern(symbol) /* Nothing */
310 # endif /* ! HAVE_WEAK_SYMBOLS */
311
312 #endif /* __ASSEMBLER__ */
313
314
315 /* On some platforms we can make internal function calls (i.e., calls of
316    functions not exported) a bit faster by using a different calling
317    convention.  */
318 #ifndef internal_function
319 # define internal_function      /* empty */
320 #endif
321
322
323 /* We want the .gnu.warning.SYMBOL section to be unallocated.  */
324 #define __make_section_unallocated(section_string)      \
325   __asm__ (".section " section_string "\n\t.previous");
326
327
328 /* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus
329    section attributes on what looks like a comment to the assembler.  */
330 #ifdef __sparc__ /* HAVE_SECTION_QUOTES */
331 # define __sec_comment "\"\n#APP\n\t#\""
332 #else
333 # define __sec_comment "\n#APP\n\t#"
334 #endif
335
336
337 /* When a reference to SYMBOL is encountered, the linker will emit a
338    warning message MSG.  */
339 #define link_warning(symbol, msg) \
340   __make_section_unallocated (".gnu.warning." #symbol) \
341   static const char __evoke_link_warning_##symbol[]     \
342     __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
343     = msg;
344
345 /* Handling on non-exported internal names.  We have to do this only
346    for shared code.  */
347 #ifdef SHARED
348 # define INTUSE(name) name##_internal
349 # define INTDEF(name) strong_alias (name, name##_internal)
350 # define INTVARDEF(name) _INTVARDEF (name, name##_internal)
351 # if defined HAVE_VISIBILITY_ATTRIBUTE
352 #  define _INTVARDEF(name, aliasname) \
353   extern __typeof (name) aliasname __attribute__ ((alias (#name), \
354                                                    visibility ("hidden")));
355 # else
356 #  define _INTVARDEF(name, aliasname) \
357   extern __typeof (name) aliasname __attribute__ ((alias (#name)));
358 # endif
359 # define INTDEF2(name, newname) strong_alias (name, newname##_internal)
360 # define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal)
361 #else
362 # define INTUSE(name) name
363 # define INTDEF(name)
364 # define INTVARDEF(name)
365 # define INTDEF2(name, newname)
366 # define INTVARDEF2(name, newname)
367 #endif
368
369
370 /* The following macros are used for PLT bypassing within libc.so
371    (and if needed other libraries similarly).
372
373    If calls to foo within libc.so should always go to foo defined in libc.so,
374    then in include/foo.h you add:
375
376    int foo(int __bar);
377    libc_hidden_proto(foo)
378
379    line and after the foo function definition:
380
381    int foo(int __bar) {
382      return __bar;
383    }
384    libc_hidden_def(foo)
385
386    or
387
388    int foo(int __bar) {
389      return __bar;
390    }
391    libc_hidden_weak(foo)
392
393    Similarly for global data: if references to foo within libc.so
394    should always go to foo defined in libc.so, then in include/foo.h:
395
396    extern int foo;
397    libc_hidden_proto(foo)
398
399    and after foo's definition:
400
401    int foo = INITIAL_FOO_VALUE;
402    libc_hidden_data_def(foo)
403
404    or
405
406    int foo = INITIAL_FOO_VALUE;
407    libc_hidden_data_weak(foo)
408
409    If foo is normally just an alias (strong or weak) to some other function,
410    you should use the normal strong_alias first, then add libc_hidden_def
411    or libc_hidden_weak:
412
413    int baz(int __bar) {
414      return __bar;
415    }
416    strong_alias(baz, foo)
417    libc_hidden_weak(foo)
418
419    If the function should be internal to multiple objects, say ld.so and
420    libc.so, the best way is to use:
421
422    #if !defined NOT_IN_libc || defined IS_IN_rtld
423    hidden_proto(foo)
424    #endif
425
426    in include/foo.h and the normal macros at all function definitions
427    depending on what DSO they belong to.
428
429    If versioned_symbol macro is used to define foo,
430    libc_hidden_ver macro should be used, as in:
431
432    int __real_foo(int __bar) {
433      return __bar;
434    }
435    versioned_symbol(libc, __real_foo, foo, GLIBC_2_1);
436    libc_hidden_ver(__real_foo, foo)
437  */
438
439 /* uClibc specific (the above comment was copied from glibc):
440  *
441  * when ppc64 will be supported, we need changes to support
442  * strong_data_alias (used by asm hidden_data_def)
443  *
444  * no versioning support, hidden[_data]_ver are noop
445  *
446  * hidden_def() in asm is _hidden_strong_alias (not strong_alias)
447  *
448  * libc_hidden_proto(foo) should be added after declaration
449  * in the header, or after extern foo... in all source files
450  * (this is discouraged).
451  * libc_hidden_def does not hide __GI_foo itself, although the name
452  * suggests it (hiding is done exclusively by libc_hidden_proto).
453
454 FIXME! - ?
455  * The reasoning to have it after the header w/ foo's prototype is
456  * to get first the __REDIRECT from original header and then create
457  * the __GI_foo alias
458
459  * Hunt for references which still go through PLT (example for x86):
460  * build shared lib, then disassemble it and search for <xxx@plt>:
461  * $ objdump -drx libuClibc-*.so >disasm.txt
462  * $ grep -F '@plt>:' disasm.txt
463  *
464  * In uclibc, malloc/free and related functions should be called
465  * through PLT (making it possible to use alternative malloc),
466  * and possibly some __pthread_xxx functions can be called through PLT
467  * (why?). The rest should not use PLT.
468  */
469
470 #if (defined __GNUC__ && defined __GNUC_MINOR__ \
471         && (( __GNUC__ >= 3 && __GNUC_MINOR__ >= 3) || __GNUC__ >= 4) \
472     ) || defined __ICC
473 # define attribute_hidden __attribute__ ((visibility ("hidden")))
474 # define attribute_protected __attribute__ ((visibility ("protected")))
475 # define __hidden_proto_hiddenattr(attrs...) __attribute__ ((visibility ("hidden"), ##attrs))
476 #else
477 # define attribute_hidden
478 # define attribute_protected
479 # define __hidden_proto_hiddenattr(attrs...)
480 #endif
481
482 #if /*!defined STATIC &&*/ !defined __BCC__
483
484 # ifndef __ASSEMBLER__
485 #  define hidden_proto(name, attrs...) __hidden_proto(name, __GI_##name, ##attrs)
486 #  define __hidden_proto(name, internal, attrs...) \
487         extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
488         __hidden_proto_hiddenattr (attrs);
489 #  define __hidden_asmname(name) __hidden_asmname1 (__USER_LABEL_PREFIX__, name)
490 #  define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
491 #  define __hidden_asmname2(prefix, name) #prefix name
492 #  define __hidden_ver1(local, internal, name) \
493         extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
494         extern __typeof (name) __EI_##name __attribute__((alias (__hidden_asmname1 (,#local))))
495 #  define hidden_ver(local, name)       __hidden_ver1(local, __GI_##name, name);
496 #  define hidden_data_ver(local, name)  hidden_ver(local, name)
497 #  define hidden_def(name)              __hidden_ver1(__GI_##name, name, name);
498 #  define hidden_data_def(name)         hidden_def(name)
499 #  define hidden_weak(name) \
500         __hidden_ver1(__GI_##name, name, name) __attribute__((weak));
501 #  define hidden_data_weak(name)        hidden_weak(name)
502
503 # else /* __ASSEMBLER__ */
504
505 #  ifdef HAVE_ASM_SET_DIRECTIVE
506 #   ifdef HAVE_ASM_GLOBAL_DOT_NAME
507 #    define _hidden_strong_alias(original, alias) \
508         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
509         .hidden C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
510         .set    C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)    ASM_LINE_SEP \
511         ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME(alias)           ASM_LINE_SEP \
512         .hidden C_SYMBOL_DOT_NAME(alias)                        ASM_LINE_SEP \
513         .set    C_SYMBOL_DOT_NAME(alias),C_SYMBOL_DOT_NAME(original)
514 #   else
515 #    define _hidden_strong_alias(original, alias) \
516         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
517         .hidden C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
518         .set    C_SYMBOL_NAME(alias),C_SYMBOL_NAME(original)
519 #   endif
520 #  else /* dont have .set directive */
521 #   ifdef HAVE_ASM_GLOBAL_DOT_NAME
522 #    define _hidden_strong_alias(original, alias) \
523         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
524         .hidden C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
525         C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)          ASM_LINE_SEP \
526         ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME(alias)           ASM_LINE_SEP \
527         .hidden C_SYMBOL_DOT_NAME(alias)                        ASM_LINE_SEP \
528         C_SYMBOL_DOT_NAME(alias) = C_SYMBOL_DOT_NAME(original)
529 #   else
530 #    define _hidden_strong_alias(original, alias) \
531         ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(alias)               ASM_LINE_SEP \
532         .hidden C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
533         C_SYMBOL_NAME(alias) = C_SYMBOL_NAME(original)
534 #   endif
535 #  endif
536
537 #  ifdef HAVE_ASM_GLOBAL_DOT_NAME
538 #   define _hidden_weak_alias(original, alias) \
539         .hidden C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
540         .hidden C_SYMBOL_DOT_NAME(alias)                        ASM_LINE_SEP \
541         weak_alias(original, alias)
542 #  else
543 #   define _hidden_weak_alias(original, alias) \
544         .hidden C_SYMBOL_NAME(alias)                            ASM_LINE_SEP \
545         weak_alias(original, alias)
546 #  endif
547
548 /* For assembly, we need to do the opposite of what we do in C:
549    in assembly gcc __REDIRECT stuff is not in place, so functions
550    are defined by its normal name and we need to create the
551    __GI_* alias to it, in C __REDIRECT causes the function definition
552    to use __GI_* name and we need to add alias to the real name.
553    There is no reason to use hidden_weak over hidden_def in assembly,
554    but we provide it for consistency with the C usage.
555    hidden_proto doesn't make sense for assembly but the equivalent
556    is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET.  */
557 #  define hidden_def(name)      _hidden_strong_alias (name, __GI_##name)
558 #  define hidden_weak(name)     _hidden_weak_alias (name, __GI_##name)
559 #  define hidden_ver(local, name) strong_alias (local, __GI_##name)
560 #  define hidden_data_def(name) _hidden_strong_alias (name, __GI_##name)
561 #  define hidden_data_weak(name)        _hidden_weak_alias (name, __GI_##name)
562 #  define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
563 #  ifdef HAVE_ASM_GLOBAL_DOT_NAME
564 #   define HIDDEN_JUMPTARGET(name) .__GI_##name
565 #  else
566 #   define HIDDEN_JUMPTARGET(name) __GI_##name
567 #  endif
568 # endif /* __ASSEMBLER__ */
569
570 #else /* not SHARED */
571
572 # ifndef __ASSEMBLER__
573 #  define hidden_proto(name, attrs...)
574 # else
575 #  define HIDDEN_JUMPTARGET(name) name
576 # endif /* not __ASSEMBLER__ */
577 # define hidden_weak(name)
578 # define hidden_def(name)
579 # define hidden_ver(local, name)
580 # define hidden_data_weak(name)
581 # define hidden_data_def(name)
582 # define hidden_data_ver(local, name)
583
584 #endif /* SHARED / not SHARED */
585
586
587 /* uClibc does not support versioning yet. */
588 #define versioned_symbol(lib, local, symbol, version) /* weak_alias(local, symbol) */
589 #undef hidden_ver
590 #define hidden_ver(local, name) /* strong_alias(local, __GI_##name) */
591 #undef hidden_data_ver
592 #define hidden_data_ver(local, name) /* strong_alias(local,__GI_##name) */
593
594 #if !defined NOT_IN_libc
595 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
596 # define libc_hidden_def(name) hidden_def (name)
597 # define libc_hidden_weak(name) hidden_weak (name)
598 # define libc_hidden_ver(local, name) hidden_ver (local, name)
599 # define libc_hidden_data_def(name) hidden_data_def (name)
600 # define libc_hidden_data_weak(name) hidden_data_weak (name)
601 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
602 #else
603 # define libc_hidden_proto(name, attrs...)
604 # define libc_hidden_def(name)
605 # define libc_hidden_weak(name)
606 # define libc_hidden_ver(local, name)
607 # define libc_hidden_data_def(name)
608 # define libc_hidden_data_weak(name)
609 # define libc_hidden_data_ver(local, name)
610 #endif
611
612 #if defined NOT_IN_libc && defined IS_IN_rtld
613 # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
614 # define rtld_hidden_def(name) hidden_def (name)
615 # define rtld_hidden_weak(name) hidden_weak (name)
616 # define rtld_hidden_ver(local, name) hidden_ver (local, name)
617 # define rtld_hidden_data_def(name) hidden_data_def (name)
618 # define rtld_hidden_data_weak(name) hidden_data_weak (name)
619 # define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name)
620 #else
621 # define rtld_hidden_proto(name, attrs...)
622 # define rtld_hidden_def(name)
623 # define rtld_hidden_weak(name)
624 # define rtld_hidden_ver(local, name)
625 # define rtld_hidden_data_def(name)
626 # define rtld_hidden_data_weak(name)
627 # define rtld_hidden_data_ver(local, name)
628 #endif
629
630 #if defined NOT_IN_libc && defined IS_IN_libm
631 # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
632 # define libm_hidden_def(name) hidden_def (name)
633 # define libm_hidden_weak(name) hidden_weak (name)
634 # define libm_hidden_ver(local, name) hidden_ver (local, name)
635 # define libm_hidden_data_def(name) hidden_data_def (name)
636 # define libm_hidden_data_weak(name) hidden_data_weak (name)
637 # define libm_hidden_data_ver(local, name) hidden_data_ver (local, name)
638 #else
639 # define libm_hidden_proto(name, attrs...)
640 # define libm_hidden_def(name)
641 # define libm_hidden_weak(name)
642 # define libm_hidden_ver(local, name)
643 # define libm_hidden_data_def(name)
644 # define libm_hidden_data_weak(name)
645 # define libm_hidden_data_ver(local, name)
646 #endif
647
648 #if defined NOT_IN_libc && defined IS_IN_libresolv
649 # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
650 # define libresolv_hidden_def(name) hidden_def (name)
651 # define libresolv_hidden_weak(name) hidden_weak (name)
652 # define libresolv_hidden_ver(local, name) hidden_ver (local, name)
653 # define libresolv_hidden_data_def(name) hidden_data_def (name)
654 # define libresolv_hidden_data_weak(name) hidden_data_weak (name)
655 # define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name)
656 #else
657 # define libresolv_hidden_proto(name, attrs...)
658 # define libresolv_hidden_def(name)
659 # define libresolv_hidden_weak(name)
660 # define libresolv_hidden_ver(local, name)
661 # define libresolv_hidden_data_def(name)
662 # define libresolv_hidden_data_weak(name)
663 # define libresolv_hidden_data_ver(local, name)
664 #endif
665
666 #if defined NOT_IN_libc && defined IS_IN_librt
667 # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
668 # define librt_hidden_def(name) hidden_def (name)
669 # define librt_hidden_weak(name) hidden_weak (name)
670 # define librt_hidden_ver(local, name) hidden_ver (local, name)
671 # define librt_hidden_data_def(name) hidden_data_def (name)
672 # define librt_hidden_data_weak(name) hidden_data_weak (name)
673 # define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
674 #else
675 # define librt_hidden_proto(name, attrs...)
676 # define librt_hidden_def(name)
677 # define librt_hidden_weak(name)
678 # define librt_hidden_ver(local, name)
679 # define librt_hidden_data_def(name)
680 # define librt_hidden_data_weak(name)
681 # define librt_hidden_data_ver(local, name)
682 #endif
683
684 #if defined NOT_IN_libc && defined IS_IN_libdl
685 # define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
686 # define libdl_hidden_def(name) hidden_def (name)
687 # define libdl_hidden_weak(name) hidden_weak (name)
688 # define libdl_hidden_ver(local, name) hidden_ver (local, name)
689 # define libdl_hidden_data_def(name) hidden_data_def (name)
690 # define libdl_hidden_data_weak(name) hidden_data_weak (name)
691 # define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name)
692 #else
693 # define libdl_hidden_proto(name, attrs...)
694 # define libdl_hidden_def(name)
695 # define libdl_hidden_weak(name)
696 # define libdl_hidden_ver(local, name)
697 # define libdl_hidden_data_def(name)
698 # define libdl_hidden_data_weak(name)
699 # define libdl_hidden_data_ver(local, name)
700 #endif
701
702 #if defined NOT_IN_libc && defined IS_IN_libintl
703 # define libintl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
704 # define libintl_hidden_def(name) hidden_def (name)
705 # define libintl_hidden_weak(name) hidden_weak (name)
706 # define libintl_hidden_ver(local, name) hidden_ver (local, name)
707 # define libintl_hidden_data_def(name) hidden_data_def (name)
708 # define libintl_hidden_data_weak(name) hidden_data_weak (name)
709 # define libintl_hidden_data_ver(local, name) hidden_data_ver(local, name)
710 #else
711 # define libintl_hidden_proto(name, attrs...)
712 # define libintl_hidden_def(name)
713 # define libintl_hidden_weak(name)
714 # define libintl_hidden_ver(local, name)
715 # define libintl_hidden_data_def(name)
716 # define libintl_hidden_data_weak(name)
717 # define libintl_hidden_data_ver(local, name)
718 #endif
719
720 #if defined NOT_IN_libc && defined IS_IN_libnsl
721 # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
722 # define libnsl_hidden_def(name) hidden_def (name)
723 # define libnsl_hidden_weak(name) hidden_weak (name)
724 # define libnsl_hidden_ver(local, name) hidden_ver (local, name)
725 # define libnsl_hidden_data_def(name) hidden_data_def (name)
726 # define libnsl_hidden_data_weak(name) hidden_data_weak (name)
727 # define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name)
728 #else
729 # define libnsl_hidden_proto(name, attrs...)
730 # define libnsl_hidden_def(name)
731 # define libnsl_hidden_weak(name)
732 # define libnsl_hidden_ver(local, name)
733 # define libnsl_hidden_data_def(name)
734 # define libnsl_hidden_data_weak(name)
735 # define libnsl_hidden_data_ver(local, name)
736 #endif
737
738 #if defined NOT_IN_libc && defined IS_IN_libutil
739 # define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
740 # define libutil_hidden_def(name) hidden_def (name)
741 # define libutil_hidden_weak(name) hidden_weak (name)
742 # define libutil_hidden_ver(local, name) hidden_ver (local, name)
743 # define libutil_hidden_data_def(name) hidden_data_def (name)
744 # define libutil_hidden_data_weak(name) hidden_data_weak (name)
745 # define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name)
746 #else
747 # define libutil_hidden_proto(name, attrs...)
748 # define libutil_hidden_def(name)
749 # define libutil_hidden_weak(name)
750 # define libutil_hidden_ver(local, name)
751 # define libutil_hidden_data_def(name)
752 # define libutil_hidden_data_weak(name)
753 # define libutil_hidden_data_ver(local, name)
754 #endif
755
756 #if defined NOT_IN_libc && defined IS_IN_libcrypt
757 # define libcrypt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
758 # define libcrypt_hidden_def(name) hidden_def (name)
759 # define libcrypt_hidden_weak(name) hidden_weak (name)
760 # define libcrypt_hidden_ver(local, name) hidden_ver (local, name)
761 # define libcrypt_hidden_data_def(name) hidden_data_def (name)
762 # define libcrypt_hidden_data_weak(name) hidden_data_weak (name)
763 # define libcrypt_hidden_data_ver(local, name) hidden_data_ver (local, name)
764 #else
765 # define libcrypt_hidden_proto(name, attrs...)
766 # define libcrypt_hidden_def(name)
767 # define libcrypt_hidden_weak(name)
768 # define libcrypt_hidden_ver(local, name)
769 # define libcrypt_hidden_data_def(name)
770 # define libcrypt_hidden_data_weak(name)
771 # define libcrypt_hidden_data_ver(local, name)
772 #endif
773
774 #if defined NOT_IN_libc && defined IS_IN_libpthread
775 # define libpthread_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
776 # define libpthread_hidden_def(name) hidden_def (name)
777 # define libpthread_hidden_weak(name) hidden_weak (name)
778 # define libpthread_hidden_ver(local, name) hidden_ver (local, name)
779 # define libpthread_hidden_data_def(name) hidden_data_def (name)
780 # define libpthread_hidden_data_weak(name) hidden_data_weak (name)
781 # define libpthread_hidden_data_ver(local, name) hidden_data_ver (local, name)
782 #else
783 # define libpthread_hidden_proto(name, attrs...)
784 # define libpthread_hidden_def(name)
785 # define libpthread_hidden_weak(name)
786 # define libpthread_hidden_ver(local, name)
787 # define libpthread_hidden_data_def(name)
788 # define libpthread_hidden_data_weak(name)
789 # define libpthread_hidden_data_ver(local, name)
790 #endif
791
792 #endif /* libc-symbols.h */