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. */
55 /* Enable declarations of GNU extensions, since we are compiling them. */
57 /* And we also need the data for the reentrant functions. */
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),
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
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"
87 #ifndef __SYMBOL_PREFIX
88 # define __SYMBOL_PREFIX
92 # define C_SYMBOL_NAME(name) name
96 # define ASM_LINE_SEP ;
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)
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)
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
167 #ifndef internal_function
168 # define internal_function /* empty */
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");
185 # define __make_section_unallocated(section_string)
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#\""
193 # define __sec_comment "\n\t#"
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))) \
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. */
218 #define static_link_warning(name)
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 \
227 /* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
228 alias to ORIGINAL, when the assembler supports such declarations
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
233 #define declare_symbol_alias(symbol, original, type, size) \
234 declare_symbol_alias_1 (symbol, original, type, size)
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 ", " \
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
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. */
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)
279 # define _elf_set_element(set, symbol) \
280 static const void *const __elf_set_##set##_element_##symbol##__ \
281 __attribute__ ((used, section (#set))) = &(symbol)
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
292 #define symbol_set_declare(set) \
293 extern char const __start_##set[] __symbol_set_attribute; \
294 extern char const __stop_##set[] __symbol_set_attribute;
296 # define __symbol_set_attribute attribute_hidden
298 # define __symbol_set_attribute __attribute__ ((weak))
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)
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
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)
325 # define symbol_version(real, name, version)
326 # define default_symbol_version(real, name, version) \
327 strong_alias(real, name)
330 #if defined SHARED || defined LIBC_NONSHARED
331 # define attribute_hidden __attribute__ ((visibility ("hidden")))
333 # define attribute_hidden
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,
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:
358 libc_hidden_def (foo)
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
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)
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)
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);
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
468 # ifndef __ASSEMBLER__
469 # define hidden_proto(name, attrs...)
470 # define hidden_tls_proto(name, attrs...)
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)
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)
492 # define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
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)
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)
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)
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)
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)
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)
549 #if IS_IN (libresolv)
550 # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
551 # define libresolv_hidden_tls_proto(name, attrs...) \
552 hidden_tls_proto (name, ##attrs)
553 # define libresolv_hidden_def(name) hidden_def (name)
554 # define libresolv_hidden_weak(name) hidden_weak (name)
555 # define libresolv_hidden_ver(local, name) hidden_ver (local, name)
556 # define libresolv_hidden_data_def(name) hidden_data_def (name)
557 # define libresolv_hidden_data_weak(name) hidden_data_weak (name)
558 # define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name)
560 # define libresolv_hidden_proto(name, attrs...)
561 # define libresolv_hidden_tls_proto(name, attrs...)
562 # define libresolv_hidden_def(name)
563 # define libresolv_hidden_weak(name)
564 # define libresolv_hidden_ver(local, name)
565 # define libresolv_hidden_data_def(name)
566 # define libresolv_hidden_data_weak(name)
567 # define libresolv_hidden_data_ver(local, name)
571 # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
572 # define librt_hidden_tls_proto(name, attrs...) \
573 hidden_tls_proto (name, ##attrs)
574 # define librt_hidden_def(name) hidden_def (name)
575 # define librt_hidden_weak(name) hidden_weak (name)
576 # define librt_hidden_ver(local, name) hidden_ver (local, name)
577 # define librt_hidden_data_def(name) hidden_data_def (name)
578 # define librt_hidden_data_weak(name) hidden_data_weak (name)
579 # define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
581 # define librt_hidden_proto(name, attrs...)
582 # define librt_hidden_tls_proto(name, attrs...)
583 # define librt_hidden_def(name)
584 # define librt_hidden_weak(name)
585 # define librt_hidden_ver(local, name)
586 # define librt_hidden_data_def(name)
587 # define librt_hidden_data_weak(name)
588 # define librt_hidden_data_ver(local, name)
592 # define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
593 # define libdl_hidden_tls_proto(name, attrs...) \
594 hidden_tls_proto (name, ##attrs)
595 # define libdl_hidden_def(name) hidden_def (name)
596 # define libdl_hidden_weak(name) hidden_weak (name)
597 # define libdl_hidden_ver(local, name) hidden_ver (local, name)
598 # define libdl_hidden_data_def(name) hidden_data_def (name)
599 # define libdl_hidden_data_weak(name) hidden_data_weak (name)
600 # define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name)
602 # define libdl_hidden_proto(name, attrs...)
603 # define libdl_hidden_tls_proto(name, attrs...)
604 # define libdl_hidden_def(name)
605 # define libdl_hidden_weak(name)
606 # define libdl_hidden_ver(local, name)
607 # define libdl_hidden_data_def(name)
608 # define libdl_hidden_data_weak(name)
609 # define libdl_hidden_data_ver(local, name)
612 #if IS_IN (libnss_files)
613 # define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
614 # define libnss_files_hidden_tls_proto(name, attrs...) \
615 hidden_tls_proto (name, ##attrs)
616 # define libnss_files_hidden_def(name) hidden_def (name)
617 # define libnss_files_hidden_weak(name) hidden_weak (name)
618 # define libnss_files_hidden_ver(local, name) hidden_ver (local, name)
619 # define libnss_files_hidden_data_def(name) hidden_data_def (name)
620 # define libnss_files_hidden_data_weak(name) hidden_data_weak (name)
621 # define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name)
623 # define libnss_files_hidden_proto(name, attrs...)
624 # define libnss_files_hidden_tls_proto(name, attrs...)
625 # define libnss_files_hidden_def(name)
626 # define libnss_files_hidden_weak(name)
627 # define libnss_files_hidden_ver(local, name)
628 # define libnss_files_hidden_data_def(name)
629 # define libnss_files_hidden_data_weak(name)
630 # define libnss_files_hidden_data_ver(local, name)
634 # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
635 # define libnsl_hidden_tls_proto(name, attrs...) \
636 hidden_tls_proto (name, ##attrs)
637 # define libnsl_hidden_def(name) hidden_def (name)
638 # define libnsl_hidden_weak(name) hidden_weak (name)
639 # define libnsl_hidden_ver(local, name) hidden_ver (local, name)
640 # define libnsl_hidden_data_def(name) hidden_data_def (name)
641 # define libnsl_hidden_data_weak(name) hidden_data_weak (name)
642 # define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name)
644 # define libnsl_hidden_proto(name, attrs...)
645 # define libnsl_hidden_tls_proto(name, attrs...)
646 # define libnsl_hidden_def(name)
647 # define libnsl_hidden_weak(name)
648 # define libnsl_hidden_ver(local, name)
649 # define libnsl_hidden_data_def(name)
650 # define libnsl_hidden_data_weak(name)
651 # define libnsl_hidden_data_ver(local, name)
654 #if IS_IN (libnss_nisplus)
655 # define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
656 # define libnss_nisplus_hidden_tls_proto(name, attrs...) \
657 hidden_tls_proto (name, ##attrs)
658 # define libnss_nisplus_hidden_def(name) hidden_def (name)
659 # define libnss_nisplus_hidden_weak(name) hidden_weak (name)
660 # define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name)
661 # define libnss_nisplus_hidden_data_def(name) hidden_data_def (name)
662 # define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name)
663 # define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name)
665 # define libnss_nisplus_hidden_proto(name, attrs...)
666 # define libnss_nisplus_hidden_tls_proto(name, attrs...)
667 # define libnss_nisplus_hidden_def(name)
668 # define libnss_nisplus_hidden_weak(name)
669 # define libnss_nisplus_hidden_ver(local, name)
670 # define libnss_nisplus_hidden_data_def(name)
671 # define libnss_nisplus_hidden_data_weak(name)
672 # define libnss_nisplus_hidden_data_ver(local, name)
675 #define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
676 #define libc_hidden_builtin_def(name) libc_hidden_def (name)
677 #define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
678 #define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
680 # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
684 # define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
685 # define libutil_hidden_tls_proto(name, attrs...) \
686 hidden_tls_proto (name, ##attrs)
687 # define libutil_hidden_def(name) hidden_def (name)
688 # define libutil_hidden_weak(name) hidden_weak (name)
689 # define libutil_hidden_ver(local, name) hidden_ver (local, name)
690 # define libutil_hidden_data_def(name) hidden_data_def (name)
691 # define libutil_hidden_data_weak(name) hidden_data_weak (name)
692 # define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name)
694 # define libutil_hidden_proto(name, attrs...)
695 # define libutil_hidden_tls_proto(name, attrs...)
696 # define libutil_hidden_def(name)
697 # define libutil_hidden_weak(name)
698 # define libutil_hidden_ver(local, name)
699 # define libutil_hidden_data_def(name)
700 # define libutil_hidden_data_weak(name)
701 # define libutil_hidden_data_ver(local, name)
704 /* Get some dirty hacks. */
705 #include <symbol-hacks.h>
707 /* Move compatibility symbols out of the way by placing them all in a
709 #ifndef __ASSEMBLER__
710 # define attribute_compat_text_section \
711 __attribute__ ((section (".text.compat")))
712 # define attribute_compat_data_section \
713 __attribute__ ((section (".data.compat")))
715 # define compat_text_section .section ".text.compat", "ax";
716 # define compat_data_section .section ".data.compat", "aw";
719 /* Marker used for indirection function symbols. */
720 #define libc_ifunc(name, expr) \
721 extern void *name##_ifunc (void) __asm__ (#name); \
722 void *name##_ifunc (void) \
725 __typeof (name) *res = expr; \
728 __asm__ (".type " #name ", %gnu_indirect_function");
730 /* The body of the function is supposed to use __get_cpu_features
731 which will, if necessary, initialize the data first. */
732 #define libm_ifunc(name, expr) \
733 extern void *name##_ifunc (void) __asm__ (#name); \
734 void *name##_ifunc (void) \
736 __typeof (name) *res = expr; \
739 __asm__ (".type " #name ", %gnu_indirect_function");
741 #ifdef HAVE_ASM_SET_DIRECTIVE
742 # define libc_ifunc_hidden_def1(local, name) \
743 __asm__ (".globl " #local "\n\t" \
744 ".hidden " #local "\n\t" \
745 ".set " #local ", " #name);
747 # define libc_ifunc_hidden_def1(local, name) \
748 __asm__ (".globl " #local "\n\t" \
749 ".hidden " #local "\n\t" \
753 #define libc_ifunc_hidden_def(name) \
754 libc_ifunc_hidden_def1 (__GI_##name, name)
756 /* Add the compiler optimization to inhibit loop transformation to library
757 calls. This is used to avoid recursive calls in memset and memmove
758 default implementations. */
759 #ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
760 # define inhibit_loop_to_libcall \
761 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
763 # define inhibit_loop_to_libcall
766 #endif /* libc-symbols.h */