Remove i486 subdirectory
[glibc.git] / include / libc-symbols.h
blob743b6f6f5bd4f2b261b601c0f6b9df8c0036bef9
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-2015 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef _LIBC_SYMBOLS_H
21 #define _LIBC_SYMBOLS_H 1
23 #define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME)
24 #define IS_IN(lib) (IN_MODULE == MODULE_##lib)
26 /* Returns true if the current module is a versioned library. Versioned
27 library names culled from shlib-versions files are assigned a MODULE_*
28 value lower than MODULE_LIBS_BEGIN. */
29 #define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN)
31 #define PASTE_NAME(a,b) PASTE_NAME1 (a,b)
32 #define PASTE_NAME1(a,b) a##b
34 /* This file's macros are included implicitly in the compilation of every
35 file in the C library by -imacros.
37 We include config.h which is generated by configure.
38 It should define for us the following symbols:
40 * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
41 * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'.
42 * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'.
46 /* This is defined for the compilation of all C library code. features.h
47 tests this to avoid inclusion of stubs.h while compiling the library,
48 before stubs.h has been generated. Some library code that is shared
49 with other packages also tests this symbol to see if it is being
50 compiled as part of the C library. We must define this before including
51 config.h, because it makes some definitions conditional on whether libc
52 itself is being compiled, or just some generator program. */
53 #define _LIBC 1
55 /* Enable declarations of GNU extensions, since we are compiling them. */
56 #define _GNU_SOURCE 1
57 /* And we also need the data for the reentrant functions. */
58 #define _REENTRANT 1
60 #include <config.h>
62 /* Define this for the benefit of portable GNU code that wants to check it.
63 Code that checks with #if will not #include <config.h> again, since we've
64 already done it (and this file is implicitly included in every compile,
65 via -include). Code that checks with #ifdef will #include <config.h>,
66 but that file should always be idempotent (i.e., it's just #define/#undef
67 and nothing else anywhere should be changing the macro state it touches),
68 so it's harmless. */
69 #define HAVE_CONFIG_H 0
71 /* Define these macros for the benefit of portable GNU code that wants to check
72 them. Of course, STDC_HEADERS is never false when building libc! */
73 #define STDC_HEADERS 1
74 #define HAVE_MBSTATE_T 1
75 #define HAVE_MBSRTOWCS 1
76 #define HAVE_LIBINTL_H 1
77 #define HAVE_WCTYPE_H 1
78 #define HAVE_ISWCTYPE 1
79 #define ENABLE_NLS 1
81 /* The symbols in all the user (non-_) macros are C symbols. */
83 #if !defined HAVE_ASM_WEAK_DIRECTIVE && !defined HAVE_ASM_WEAKEXT_DIRECTIVE
84 # error "weak symbol support needed"
85 #endif
87 #ifndef __SYMBOL_PREFIX
88 # define __SYMBOL_PREFIX
89 #endif
91 #ifndef C_SYMBOL_NAME
92 # define C_SYMBOL_NAME(name) name
93 #endif
95 #ifndef ASM_LINE_SEP
96 # define ASM_LINE_SEP ;
97 #endif
99 #ifndef __ASSEMBLER__
100 /* GCC understands weak symbols and aliases; use its interface where
101 possible, instead of embedded assembly language. */
103 /* Define ALIASNAME as a strong alias for NAME. */
104 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
105 # define _strong_alias(name, aliasname) \
106 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
108 /* This comes between the return type and function name in
109 a function definition to make that definition weak. */
110 # define weak_function __attribute__ ((weak))
111 # define weak_const_function __attribute__ ((weak, __const__))
113 /* Define ALIASNAME as a weak alias for NAME.
114 If weak aliases are not available, this defines a strong alias. */
115 # define weak_alias(name, aliasname) _weak_alias (name, aliasname)
116 # define _weak_alias(name, aliasname) \
117 extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
119 /* Same as WEAK_ALIAS, but mark symbol as hidden. */
120 # define weak_hidden_alias(name, aliasname) \
121 _weak_hidden_alias (name, aliasname)
122 # define _weak_hidden_alias(name, aliasname) \
123 extern __typeof (name) aliasname \
124 __attribute__ ((weak, alias (#name), __visibility__ ("hidden")));
126 /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
127 # define weak_extern(symbol) _weak_extern (weak symbol)
128 # define _weak_extern(expr) _Pragma (#expr)
131 #else /* __ASSEMBLER__ */
133 # ifdef HAVE_ASM_SET_DIRECTIVE
134 # define strong_alias(original, alias) \
135 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
136 .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
137 # define strong_data_alias(original, alias) strong_alias(original, alias)
138 # else
139 # define strong_alias(original, alias) \
140 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
141 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
142 # define strong_data_alias(original, alias) strong_alias(original, alias)
143 # endif
145 # ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
146 # define weak_alias(original, alias) \
147 .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
148 # define weak_extern(symbol) \
149 .weakext C_SYMBOL_NAME (symbol)
151 # else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
153 # define weak_alias(original, alias) \
154 .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
155 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
157 # define weak_extern(symbol) \
158 .weak C_SYMBOL_NAME (symbol)
160 # endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
162 #endif /* __ASSEMBLER__ */
164 /* On some platforms we can make internal function calls (i.e., calls of
165 functions not exported) a bit faster by using a different calling
166 convention. */
167 #ifndef internal_function
168 # define internal_function /* empty */
169 #endif
171 /* Determine the return address. */
172 #define RETURN_ADDRESS(nr) \
173 __builtin_extract_return_addr (__builtin_return_address (nr))
175 /* When a reference to SYMBOL is encountered, the linker will emit a
176 warning message MSG. */
177 /* We want the .gnu.warning.SYMBOL section to be unallocated. */
178 #ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
179 # define __make_section_unallocated(section_string) \
180 asm (".section " section_string "\n\t.previous");
181 #elif defined HAVE_ASM_POPSECTION_DIRECTIVE
182 # define __make_section_unallocated(section_string) \
183 asm (".pushsection " section_string "\n\t.popsection");
184 #else
185 # define __make_section_unallocated(section_string)
186 #endif
188 /* Tacking on "\n\t#" to the section name makes gcc put it's bogus
189 section attributes on what looks like a comment to the assembler. */
190 #ifdef HAVE_SECTION_QUOTES
191 # define __sec_comment "\"\n\t#\""
192 #else
193 # define __sec_comment "\n\t#"
194 #endif
195 #define link_warning(symbol, msg) \
196 __make_section_unallocated (".gnu.warning." #symbol) \
197 static const char __evoke_link_warning_##symbol[] \
198 __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
199 = msg;
200 #define libc_freeres_ptr(decl) \
201 __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
202 decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
203 #define __libc_freeres_fn_section \
204 __attribute__ ((section ("__libc_freeres_fn")))
206 #define libc_freeres_fn(name) \
207 static void name (void) __attribute_used__ __libc_freeres_fn_section; \
208 text_set_element (__libc_subfreeres, name); \
209 static void name (void)
211 /* A canned warning for sysdeps/stub functions. */
212 #define stub_warning(name) \
213 __make_section_unallocated (".gnu.glibc-stub." #name) \
214 link_warning (name, #name " is not implemented and will always fail")
216 /* Warning for linking functions calling dlopen into static binaries. */
217 #ifdef SHARED
218 #define static_link_warning(name)
219 #else
220 #define static_link_warning(name) static_link_warning1(name)
221 #define static_link_warning1(name) \
222 link_warning(name, "Using '" #name "' in statically linked applications \
223 requires at runtime the shared libraries from the glibc version used \
224 for linking")
225 #endif
227 /* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
228 alias to ORIGINAL, when the assembler supports such declarations
229 (such as in ELF).
230 This is only necessary when defining something in assembly, or playing
231 funny alias games where the size should be other than what the compiler
232 thinks it is. */
233 #define declare_symbol_alias(symbol, original, type, size) \
234 declare_symbol_alias_1 (symbol, original, type, size)
235 #ifdef __ASSEMBLER__
236 # define declare_symbol_alias_1(symbol, original, type, size) \
237 strong_alias (original, symbol); \
238 .type C_SYMBOL_NAME (symbol), %##type; \
239 .size C_SYMBOL_NAME (symbol), size
240 #else /* Not __ASSEMBLER__. */
241 # define declare_symbol_alias_1(symbol, original, type, size) \
242 asm (".globl " __SYMBOL_PREFIX #symbol \
243 "\n\t" declare_symbol_alias_1_alias (symbol, original) \
244 "\n\t.type " __SYMBOL_PREFIX #symbol ", " \
245 "%" #type \
246 "\n\t.size " __SYMBOL_PREFIX #symbol ", " #size);
247 # ifdef HAVE_ASM_SET_DIRECTIVE
248 # define declare_symbol_alias_1_alias(symbol, original) \
249 ".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX #original
250 # else
251 # define declare_symbol_alias_1_alias(symbol, original) \
252 __SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX #original
253 # endif /* HAVE_ASM_SET_DIRECTIVE */
254 #endif /* __ASSEMBLER__ */
261 /* Symbol set support macros. */
263 /* Make SYMBOL, which is in the text segment, an element of SET. */
264 #define text_set_element(set, symbol) _elf_set_element(set, symbol)
265 /* Make SYMBOL, which is in the data segment, an element of SET. */
266 #define data_set_element(set, symbol) _elf_set_element(set, symbol)
267 /* Make SYMBOL, which is in the bss segment, an element of SET. */
268 #define bss_set_element(set, symbol) _elf_set_element(set, symbol)
270 /* These are all done the same way in ELF.
271 There is a new section created for each set. */
272 #ifdef SHARED
273 /* When building a shared library, make the set section writable,
274 because it will need to be relocated at run time anyway. */
275 # define _elf_set_element(set, symbol) \
276 static const void *__elf_set_##set##_element_##symbol##__ \
277 __attribute__ ((used, section (#set))) = &(symbol)
278 #else
279 # define _elf_set_element(set, symbol) \
280 static const void *const __elf_set_##set##_element_##symbol##__ \
281 __attribute__ ((used, section (#set))) = &(symbol)
282 #endif
284 /* Define SET as a symbol set. This may be required (it is in a.out) to
285 be able to use the set's contents. */
286 #define symbol_set_define(set) symbol_set_declare(set)
288 /* Declare SET for use in this module, if defined in another module.
289 In a shared library, this is always local to that shared object.
290 For static linking, the set might be wholly absent and so we use
291 weak references. */
292 #define symbol_set_declare(set) \
293 extern char const __start_##set[] __symbol_set_attribute; \
294 extern char const __stop_##set[] __symbol_set_attribute;
295 #ifdef SHARED
296 # define __symbol_set_attribute attribute_hidden
297 #else
298 # define __symbol_set_attribute __attribute__ ((weak))
299 #endif
301 /* Return a pointer (void *const *) to the first element of SET. */
302 #define symbol_set_first_element(set) ((void *const *) (&__start_##set))
304 /* Return true iff PTR (a void *const *) has been incremented
305 past the last element in SET. */
306 #define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
308 #ifdef SHARED
309 # define symbol_version(real, name, version) \
310 _symbol_version(real, name, version)
311 # define default_symbol_version(real, name, version) \
312 _default_symbol_version(real, name, version)
313 # ifdef __ASSEMBLER__
314 # define _symbol_version(real, name, version) \
315 .symver real, name##@##version
316 # define _default_symbol_version(real, name, version) \
317 .symver real, name##@##@##version
318 # else
319 # define _symbol_version(real, name, version) \
320 __asm__ (".symver " #real "," #name "@" #version)
321 # define _default_symbol_version(real, name, version) \
322 __asm__ (".symver " #real "," #name "@@" #version)
323 # endif
324 #else
325 # define symbol_version(real, name, version)
326 # define default_symbol_version(real, name, version) \
327 strong_alias(real, name)
328 #endif
330 #if defined SHARED || defined LIBC_NONSHARED
331 # define attribute_hidden __attribute__ ((visibility ("hidden")))
332 #else
333 # define attribute_hidden
334 #endif
336 #define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
338 #define attribute_relro __attribute__ ((section (".data.rel.ro")))
340 /* The following macros are used for PLT bypassing within libc.so
341 (and if needed other libraries similarly).
342 First of all, you need to have the function prototyped somewhere,
343 say in foo/foo.h:
345 int foo (int __bar);
347 If calls to foo within libc.so should always go to foo defined in libc.so,
348 then in include/foo.h you add:
350 libc_hidden_proto (foo)
352 line and after the foo function definition:
354 int foo (int __bar)
356 return __bar;
358 libc_hidden_def (foo)
362 int foo (int __bar)
364 return __bar;
366 libc_hidden_weak (foo)
368 Similarly for global data. If references to foo within libc.so should
369 always go to foo defined in libc.so, then in include/foo.h you add:
371 libc_hidden_proto (foo)
373 line and after foo's definition:
375 int foo = INITIAL_FOO_VALUE;
376 libc_hidden_data_def (foo)
380 int foo = INITIAL_FOO_VALUE;
381 libc_hidden_data_weak (foo)
383 If foo is normally just an alias (strong or weak) to some other function,
384 you should use the normal strong_alias first, then add libc_hidden_def
385 or libc_hidden_weak:
387 int baz (int __bar)
389 return __bar;
391 strong_alias (baz, foo)
392 libc_hidden_weak (foo)
394 If the function should be internal to multiple objects, say ld.so and
395 libc.so, the best way is to use:
397 #if IS_IN (libc) || IS_IN (rtld)
398 hidden_proto (foo)
399 #endif
401 in include/foo.h and the normal macros at all function definitions
402 depending on what DSO they belong to.
404 If versioned_symbol macro is used to define foo,
405 libc_hidden_ver macro should be used, as in:
407 int __real_foo (int __bar)
409 return __bar;
411 versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
412 libc_hidden_ver (__real_foo, foo) */
414 #if defined SHARED && !defined NO_HIDDEN
415 # ifndef __ASSEMBLER__
416 # define __hidden_proto_hiddenattr(attrs...) \
417 __attribute__ ((visibility ("hidden"), ##attrs))
418 # define hidden_proto(name, attrs...) \
419 __hidden_proto (name, , __GI_##name, ##attrs)
420 # define hidden_tls_proto(name, attrs...) \
421 __hidden_proto (name, __thread, __GI_##name, ##attrs)
422 # define __hidden_proto(name, thread, internal, attrs...) \
423 extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
424 __hidden_proto_hiddenattr (attrs);
425 # define __hidden_asmname(name) \
426 __hidden_asmname1 (__USER_LABEL_PREFIX__, name)
427 # define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
428 # define __hidden_asmname2(prefix, name) #prefix name
429 # define __hidden_ver1(local, internal, name) \
430 extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
431 extern __typeof (name) __EI_##name \
432 __attribute__((alias (__hidden_asmname (#local))))
433 # define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
434 # define hidden_data_ver(local, name) hidden_ver(local, name)
435 # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
436 # define hidden_data_def(name) hidden_def(name)
437 # define hidden_weak(name) \
438 __hidden_ver1(__GI_##name, name, name) __attribute__((weak));
439 # define hidden_data_weak(name) hidden_weak(name)
440 # define hidden_nolink(name, lib, version) \
441 __hidden_nolink1 (__GI_##name, __EI_##name, name, VERSION_##lib##_##version)
442 # define __hidden_nolink1(local, internal, name, version) \
443 __hidden_nolink2 (local, internal, name, version)
444 # define __hidden_nolink2(local, internal, name, version) \
445 extern __typeof (name) internal __attribute__ ((alias (#local))); \
446 __hidden_nolink3 (local, internal, #name "@" #version)
447 # define __hidden_nolink3(local, internal, vername) \
448 __asm__ (".symver " #internal ", " vername);
449 # else
450 /* For assembly, we need to do the opposite of what we do in C:
451 in assembly gcc __REDIRECT stuff is not in place, so functions
452 are defined by its normal name and we need to create the
453 __GI_* alias to it, in C __REDIRECT causes the function definition
454 to use __GI_* name and we need to add alias to the real name.
455 There is no reason to use hidden_weak over hidden_def in assembly,
456 but we provide it for consistency with the C usage.
457 hidden_proto doesn't make sense for assembly but the equivalent
458 is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */
459 # define hidden_def(name) strong_alias (name, __GI_##name)
460 # define hidden_weak(name) hidden_def (name)
461 # define hidden_ver(local, name) strong_alias (local, __GI_##name)
462 # define hidden_data_def(name) strong_data_alias (name, __GI_##name)
463 # define hidden_data_weak(name) hidden_data_def (name)
464 # define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
465 # define HIDDEN_JUMPTARGET(name) __GI_##name
466 # endif
467 #else
468 # ifndef __ASSEMBLER__
469 # define hidden_proto(name, attrs...)
470 # define hidden_tls_proto(name, attrs...)
471 # else
472 # define HIDDEN_JUMPTARGET(name) JUMPTARGET(name)
473 # endif /* Not __ASSEMBLER__ */
474 # define hidden_weak(name)
475 # define hidden_def(name)
476 # define hidden_ver(local, name)
477 # define hidden_data_weak(name)
478 # define hidden_data_def(name)
479 # define hidden_data_ver(local, name)
480 # define hidden_nolink(name, lib, version)
481 #endif
483 #if IS_IN (libc)
484 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
485 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
486 # define libc_hidden_def(name) hidden_def (name)
487 # define libc_hidden_weak(name) hidden_weak (name)
488 # ifdef LINK_OBSOLETE_RPC
489 /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */
490 # define libc_hidden_nolink_sunrpc(name, version) hidden_def (name)
491 # else
492 # define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
493 # endif
494 # define libc_hidden_ver(local, name) hidden_ver (local, name)
495 # define libc_hidden_data_def(name) hidden_data_def (name)
496 # define libc_hidden_data_weak(name) hidden_data_weak (name)
497 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
498 #else
499 # define libc_hidden_proto(name, attrs...)
500 # define libc_hidden_tls_proto(name, attrs...)
501 # define libc_hidden_def(name)
502 # define libc_hidden_weak(name)
503 # define libc_hidden_ver(local, name)
504 # define libc_hidden_data_def(name)
505 # define libc_hidden_data_weak(name)
506 # define libc_hidden_data_ver(local, name)
507 #endif
509 #if IS_IN (rtld)
510 # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
511 # define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
512 # define rtld_hidden_def(name) hidden_def (name)
513 # define rtld_hidden_weak(name) hidden_weak (name)
514 # define rtld_hidden_ver(local, name) hidden_ver (local, name)
515 # define rtld_hidden_data_def(name) hidden_data_def (name)
516 # define rtld_hidden_data_weak(name) hidden_data_weak (name)
517 # define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name)
518 #else
519 # define rtld_hidden_proto(name, attrs...)
520 # define rtld_hidden_tls_proto(name, attrs...)
521 # define rtld_hidden_def(name)
522 # define rtld_hidden_weak(name)
523 # define rtld_hidden_ver(local, name)
524 # define rtld_hidden_data_def(name)
525 # define rtld_hidden_data_weak(name)
526 # define rtld_hidden_data_ver(local, name)
527 #endif
529 #if IS_IN (libm)
530 # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
531 # define libm_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
532 # define libm_hidden_def(name) hidden_def (name)
533 # define libm_hidden_weak(name) hidden_weak (name)
534 # define libm_hidden_ver(local, name) hidden_ver (local, name)
535 # define libm_hidden_data_def(name) hidden_data_def (name)
536 # define libm_hidden_data_weak(name) hidden_data_weak (name)
537 # define libm_hidden_data_ver(local, name) hidden_data_ver (local, name)
538 #else
539 # define libm_hidden_proto(name, attrs...)
540 # define libm_hidden_tls_proto(name, attrs...)
541 # define libm_hidden_def(name)
542 # define libm_hidden_weak(name)
543 # define libm_hidden_ver(local, name)
544 # define libm_hidden_data_def(name)
545 # define libm_hidden_data_weak(name)
546 # define libm_hidden_data_ver(local, name)
547 #endif
549 #if IS_IN (libmvec)
550 # define libmvec_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
551 # define libmvec_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
552 # define libmvec_hidden_def(name) hidden_def (name)
553 # define libmvec_hidden_weak(name) hidden_weak (name)
554 # define libmvec_hidden_ver(local, name) hidden_ver (local, name)
555 # define libmvec_hidden_data_def(name) hidden_data_def (name)
556 # define libmvec_hidden_data_weak(name) hidden_data_weak (name)
557 # define libmvec_hidden_data_ver(local, name) hidden_data_ver (local, name)
558 #else
559 # define libmvec_hidden_proto(name, attrs...)
560 # define libmvec_hidden_tls_proto(name, attrs...)
561 # define libmvec_hidden_def(name)
562 # define libmvec_hidden_weak(name)
563 # define libmvec_hidden_ver(local, name)
564 # define libmvec_hidden_data_def(name)
565 # define libmvec_hidden_data_weak(name)
566 # define libmvec_hidden_data_ver(local, name)
567 #endif
569 #if IS_IN (libresolv)
570 # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
571 # define libresolv_hidden_tls_proto(name, attrs...) \
572 hidden_tls_proto (name, ##attrs)
573 # define libresolv_hidden_def(name) hidden_def (name)
574 # define libresolv_hidden_weak(name) hidden_weak (name)
575 # define libresolv_hidden_ver(local, name) hidden_ver (local, name)
576 # define libresolv_hidden_data_def(name) hidden_data_def (name)
577 # define libresolv_hidden_data_weak(name) hidden_data_weak (name)
578 # define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name)
579 #else
580 # define libresolv_hidden_proto(name, attrs...)
581 # define libresolv_hidden_tls_proto(name, attrs...)
582 # define libresolv_hidden_def(name)
583 # define libresolv_hidden_weak(name)
584 # define libresolv_hidden_ver(local, name)
585 # define libresolv_hidden_data_def(name)
586 # define libresolv_hidden_data_weak(name)
587 # define libresolv_hidden_data_ver(local, name)
588 #endif
590 #if IS_IN (librt)
591 # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
592 # define librt_hidden_tls_proto(name, attrs...) \
593 hidden_tls_proto (name, ##attrs)
594 # define librt_hidden_def(name) hidden_def (name)
595 # define librt_hidden_weak(name) hidden_weak (name)
596 # define librt_hidden_ver(local, name) hidden_ver (local, name)
597 # define librt_hidden_data_def(name) hidden_data_def (name)
598 # define librt_hidden_data_weak(name) hidden_data_weak (name)
599 # define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
600 #else
601 # define librt_hidden_proto(name, attrs...)
602 # define librt_hidden_tls_proto(name, attrs...)
603 # define librt_hidden_def(name)
604 # define librt_hidden_weak(name)
605 # define librt_hidden_ver(local, name)
606 # define librt_hidden_data_def(name)
607 # define librt_hidden_data_weak(name)
608 # define librt_hidden_data_ver(local, name)
609 #endif
611 #if IS_IN (libdl)
612 # define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
613 # define libdl_hidden_tls_proto(name, attrs...) \
614 hidden_tls_proto (name, ##attrs)
615 # define libdl_hidden_def(name) hidden_def (name)
616 # define libdl_hidden_weak(name) hidden_weak (name)
617 # define libdl_hidden_ver(local, name) hidden_ver (local, name)
618 # define libdl_hidden_data_def(name) hidden_data_def (name)
619 # define libdl_hidden_data_weak(name) hidden_data_weak (name)
620 # define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name)
621 #else
622 # define libdl_hidden_proto(name, attrs...)
623 # define libdl_hidden_tls_proto(name, attrs...)
624 # define libdl_hidden_def(name)
625 # define libdl_hidden_weak(name)
626 # define libdl_hidden_ver(local, name)
627 # define libdl_hidden_data_def(name)
628 # define libdl_hidden_data_weak(name)
629 # define libdl_hidden_data_ver(local, name)
630 #endif
632 #if IS_IN (libnss_files)
633 # define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
634 # define libnss_files_hidden_tls_proto(name, attrs...) \
635 hidden_tls_proto (name, ##attrs)
636 # define libnss_files_hidden_def(name) hidden_def (name)
637 # define libnss_files_hidden_weak(name) hidden_weak (name)
638 # define libnss_files_hidden_ver(local, name) hidden_ver (local, name)
639 # define libnss_files_hidden_data_def(name) hidden_data_def (name)
640 # define libnss_files_hidden_data_weak(name) hidden_data_weak (name)
641 # define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name)
642 #else
643 # define libnss_files_hidden_proto(name, attrs...)
644 # define libnss_files_hidden_tls_proto(name, attrs...)
645 # define libnss_files_hidden_def(name)
646 # define libnss_files_hidden_weak(name)
647 # define libnss_files_hidden_ver(local, name)
648 # define libnss_files_hidden_data_def(name)
649 # define libnss_files_hidden_data_weak(name)
650 # define libnss_files_hidden_data_ver(local, name)
651 #endif
653 #if IS_IN (libnsl)
654 # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
655 # define libnsl_hidden_tls_proto(name, attrs...) \
656 hidden_tls_proto (name, ##attrs)
657 # define libnsl_hidden_def(name) hidden_def (name)
658 # define libnsl_hidden_weak(name) hidden_weak (name)
659 # define libnsl_hidden_ver(local, name) hidden_ver (local, name)
660 # define libnsl_hidden_data_def(name) hidden_data_def (name)
661 # define libnsl_hidden_data_weak(name) hidden_data_weak (name)
662 # define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name)
663 #else
664 # define libnsl_hidden_proto(name, attrs...)
665 # define libnsl_hidden_tls_proto(name, attrs...)
666 # define libnsl_hidden_def(name)
667 # define libnsl_hidden_weak(name)
668 # define libnsl_hidden_ver(local, name)
669 # define libnsl_hidden_data_def(name)
670 # define libnsl_hidden_data_weak(name)
671 # define libnsl_hidden_data_ver(local, name)
672 #endif
674 #if IS_IN (libnss_nisplus)
675 # define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
676 # define libnss_nisplus_hidden_tls_proto(name, attrs...) \
677 hidden_tls_proto (name, ##attrs)
678 # define libnss_nisplus_hidden_def(name) hidden_def (name)
679 # define libnss_nisplus_hidden_weak(name) hidden_weak (name)
680 # define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name)
681 # define libnss_nisplus_hidden_data_def(name) hidden_data_def (name)
682 # define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name)
683 # define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name)
684 #else
685 # define libnss_nisplus_hidden_proto(name, attrs...)
686 # define libnss_nisplus_hidden_tls_proto(name, attrs...)
687 # define libnss_nisplus_hidden_def(name)
688 # define libnss_nisplus_hidden_weak(name)
689 # define libnss_nisplus_hidden_ver(local, name)
690 # define libnss_nisplus_hidden_data_def(name)
691 # define libnss_nisplus_hidden_data_weak(name)
692 # define libnss_nisplus_hidden_data_ver(local, name)
693 #endif
695 #define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
696 #define libc_hidden_builtin_def(name) libc_hidden_def (name)
697 #define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
698 #define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
699 #ifdef __ASSEMBLER__
700 # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
701 #endif
703 #if IS_IN (libutil)
704 # define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
705 # define libutil_hidden_tls_proto(name, attrs...) \
706 hidden_tls_proto (name, ##attrs)
707 # define libutil_hidden_def(name) hidden_def (name)
708 # define libutil_hidden_weak(name) hidden_weak (name)
709 # define libutil_hidden_ver(local, name) hidden_ver (local, name)
710 # define libutil_hidden_data_def(name) hidden_data_def (name)
711 # define libutil_hidden_data_weak(name) hidden_data_weak (name)
712 # define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name)
713 #else
714 # define libutil_hidden_proto(name, attrs...)
715 # define libutil_hidden_tls_proto(name, attrs...)
716 # define libutil_hidden_def(name)
717 # define libutil_hidden_weak(name)
718 # define libutil_hidden_ver(local, name)
719 # define libutil_hidden_data_def(name)
720 # define libutil_hidden_data_weak(name)
721 # define libutil_hidden_data_ver(local, name)
722 #endif
724 /* Get some dirty hacks. */
725 #include <symbol-hacks.h>
727 /* Move compatibility symbols out of the way by placing them all in a
728 special section. */
729 #ifndef __ASSEMBLER__
730 # define attribute_compat_text_section \
731 __attribute__ ((section (".text.compat")))
732 # define attribute_compat_data_section \
733 __attribute__ ((section (".data.compat")))
734 #else
735 # define compat_text_section .section ".text.compat", "ax";
736 # define compat_data_section .section ".data.compat", "aw";
737 #endif
739 /* Marker used for indirection function symbols. */
740 #define libc_ifunc(name, expr) \
741 extern void *name##_ifunc (void) __asm__ (#name); \
742 void *name##_ifunc (void) \
744 INIT_ARCH (); \
745 __typeof (name) *res = expr; \
746 return res; \
748 __asm__ (".type " #name ", %gnu_indirect_function");
750 /* The body of the function is supposed to use __get_cpu_features
751 which will, if necessary, initialize the data first. */
752 #define libm_ifunc(name, expr) \
753 extern void *name##_ifunc (void) __asm__ (#name); \
754 void *name##_ifunc (void) \
756 __typeof (name) *res = expr; \
757 return res; \
759 __asm__ (".type " #name ", %gnu_indirect_function");
761 #ifdef HAVE_ASM_SET_DIRECTIVE
762 # define libc_ifunc_hidden_def1(local, name) \
763 __asm__ (".globl " #local "\n\t" \
764 ".hidden " #local "\n\t" \
765 ".set " #local ", " #name);
766 #else
767 # define libc_ifunc_hidden_def1(local, name) \
768 __asm__ (".globl " #local "\n\t" \
769 ".hidden " #local "\n\t" \
770 #local " = " #name);
771 #endif
773 #define libc_ifunc_hidden_def(name) \
774 libc_ifunc_hidden_def1 (__GI_##name, name)
776 /* Add the compiler optimization to inhibit loop transformation to library
777 calls. This is used to avoid recursive calls in memset and memmove
778 default implementations. */
779 #ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
780 # define inhibit_loop_to_libcall \
781 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
782 #else
783 # define inhibit_loop_to_libcall
784 #endif
786 #endif /* libc-symbols.h */