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-2016 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 symbol:
40 * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
44 /* This is defined for the compilation of all C library code. features.h
45 tests this to avoid inclusion of stubs.h while compiling the library,
46 before stubs.h has been generated. Some library code that is shared
47 with other packages also tests this symbol to see if it is being
48 compiled as part of the C library. We must define this before including
49 config.h, because it makes some definitions conditional on whether libc
50 itself is being compiled, or just some generator program. */
53 /* Enable declarations of GNU extensions, since we are compiling them. */
55 /* And we also need the data for the reentrant functions. */
60 /* Define this for the benefit of portable GNU code that wants to check it.
61 Code that checks with #if will not #include <config.h> again, since we've
62 already done it (and this file is implicitly included in every compile,
63 via -include). Code that checks with #ifdef will #include <config.h>,
64 but that file should always be idempotent (i.e., it's just #define/#undef
65 and nothing else anywhere should be changing the macro state it touches),
67 #define HAVE_CONFIG_H 0
69 /* Define these macros for the benefit of portable GNU code that wants to check
70 them. Of course, STDC_HEADERS is never false when building libc! */
71 #define STDC_HEADERS 1
72 #define HAVE_MBSTATE_T 1
73 #define HAVE_MBSRTOWCS 1
74 #define HAVE_LIBINTL_H 1
75 #define HAVE_WCTYPE_H 1
76 #define HAVE_ISWCTYPE 1
79 /* The symbols in all the user (non-_) macros are C symbols. */
81 #ifndef __SYMBOL_PREFIX
82 # define __SYMBOL_PREFIX
86 # define C_SYMBOL_NAME(name) name
90 # define ASM_LINE_SEP ;
94 /* GCC understands weak symbols and aliases; use its interface where
95 possible, instead of embedded assembly language. */
97 /* Define ALIASNAME as a strong alias for NAME. */
98 # define strong_alias(name, aliasname) _strong_alias(name, aliasname)
99 # define _strong_alias(name, aliasname) \
100 extern __typeof (name) aliasname __attribute__ ((alias (#name)));
102 /* This comes between the return type and function name in
103 a function definition to make that definition weak. */
104 # define weak_function __attribute__ ((weak))
105 # define weak_const_function __attribute__ ((weak, __const__))
107 /* Define ALIASNAME as a weak alias for NAME.
108 If weak aliases are not available, this defines a strong alias. */
109 # define weak_alias(name, aliasname) _weak_alias (name, aliasname)
110 # define _weak_alias(name, aliasname) \
111 extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
113 /* Same as WEAK_ALIAS, but mark symbol as hidden. */
114 # define weak_hidden_alias(name, aliasname) \
115 _weak_hidden_alias (name, aliasname)
116 # define _weak_hidden_alias(name, aliasname) \
117 extern __typeof (name) aliasname \
118 __attribute__ ((weak, alias (#name), __visibility__ ("hidden")));
120 /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
121 # define weak_extern(symbol) _weak_extern (weak symbol)
122 # define _weak_extern(expr) _Pragma (#expr)
125 #else /* __ASSEMBLER__ */
127 # ifdef HAVE_ASM_SET_DIRECTIVE
128 # define strong_alias(original, alias) \
129 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
130 .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
131 # define strong_data_alias(original, alias) strong_alias(original, alias)
133 # define strong_alias(original, alias) \
134 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
135 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
136 # define strong_data_alias(original, alias) strong_alias(original, alias)
139 # define weak_alias(original, alias) \
140 .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
141 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
143 # define weak_extern(symbol) \
144 .weak C_SYMBOL_NAME (symbol)
146 #endif /* __ASSEMBLER__ */
148 /* On some platforms we can make internal function calls (i.e., calls of
149 functions not exported) a bit faster by using a different calling
151 #ifndef internal_function
152 # define internal_function /* empty */
155 /* Determine the return address. */
156 #define RETURN_ADDRESS(nr) \
157 __builtin_extract_return_addr (__builtin_return_address (nr))
159 /* When a reference to SYMBOL is encountered, the linker will emit a
160 warning message MSG. */
161 /* We want the .gnu.warning.SYMBOL section to be unallocated. */
162 #define __make_section_unallocated(section_string) \
163 asm (".section " section_string "\n\t.previous");
165 /* Tacking on "\n\t#" to the section name makes gcc put it's bogus
166 section attributes on what looks like a comment to the assembler. */
167 #ifdef HAVE_SECTION_QUOTES
168 # define __sec_comment "\"\n\t#\""
170 # define __sec_comment "\n\t#"
172 #define link_warning(symbol, msg) \
173 __make_section_unallocated (".gnu.warning." #symbol) \
174 static const char __evoke_link_warning_##symbol[] \
175 __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
177 #define libc_freeres_ptr(decl) \
178 __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
179 decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
180 #define __libc_freeres_fn_section \
181 __attribute__ ((section ("__libc_freeres_fn")))
183 #define libc_freeres_fn(name) \
184 static void name (void) __attribute_used__ __libc_freeres_fn_section; \
185 text_set_element (__libc_subfreeres, name); \
186 static void name (void)
188 /* A canned warning for sysdeps/stub functions. */
189 #define stub_warning(name) \
190 __make_section_unallocated (".gnu.glibc-stub." #name) \
191 link_warning (name, #name " is not implemented and will always fail")
193 /* Warning for linking functions calling dlopen into static binaries. */
195 #define static_link_warning(name)
197 #define static_link_warning(name) static_link_warning1(name)
198 #define static_link_warning1(name) \
199 link_warning(name, "Using '" #name "' in statically linked applications \
200 requires at runtime the shared libraries from the glibc version used \
204 /* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
205 alias to ORIGINAL, when the assembler supports such declarations
207 This is only necessary when defining something in assembly, or playing
208 funny alias games where the size should be other than what the compiler
210 #define declare_symbol_alias(symbol, original, type, size) \
211 declare_symbol_alias_1 (symbol, original, type, size)
213 # define declare_symbol_alias_1(symbol, original, type, size) \
214 strong_alias (original, symbol); \
215 .type C_SYMBOL_NAME (symbol), %##type; \
216 .size C_SYMBOL_NAME (symbol), size
217 #else /* Not __ASSEMBLER__. */
218 # define declare_symbol_alias_1(symbol, original, type, size) \
219 asm (".globl " __SYMBOL_PREFIX #symbol \
220 "\n\t" declare_symbol_alias_1_alias (symbol, original) \
221 "\n\t.type " __SYMBOL_PREFIX #symbol ", " \
223 "\n\t.size " __SYMBOL_PREFIX #symbol ", " #size);
224 # ifdef HAVE_ASM_SET_DIRECTIVE
225 # define declare_symbol_alias_1_alias(symbol, original) \
226 ".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX #original
228 # define declare_symbol_alias_1_alias(symbol, original) \
229 __SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX #original
230 # endif /* HAVE_ASM_SET_DIRECTIVE */
231 #endif /* __ASSEMBLER__ */
238 /* Symbol set support macros. */
240 /* Make SYMBOL, which is in the text segment, an element of SET. */
241 #define text_set_element(set, symbol) _elf_set_element(set, symbol)
242 /* Make SYMBOL, which is in the data segment, an element of SET. */
243 #define data_set_element(set, symbol) _elf_set_element(set, symbol)
244 /* Make SYMBOL, which is in the bss segment, an element of SET. */
245 #define bss_set_element(set, symbol) _elf_set_element(set, symbol)
247 /* These are all done the same way in ELF.
248 There is a new section created for each set. */
250 /* When building a shared library, make the set section writable,
251 because it will need to be relocated at run time anyway. */
252 # define _elf_set_element(set, symbol) \
253 static const void *__elf_set_##set##_element_##symbol##__ \
254 __attribute__ ((used, section (#set))) = &(symbol)
256 # define _elf_set_element(set, symbol) \
257 static const void *const __elf_set_##set##_element_##symbol##__ \
258 __attribute__ ((used, section (#set))) = &(symbol)
261 /* Define SET as a symbol set. This may be required (it is in a.out) to
262 be able to use the set's contents. */
263 #define symbol_set_define(set) symbol_set_declare(set)
265 /* Declare SET for use in this module, if defined in another module.
266 In a shared library, this is always local to that shared object.
267 For static linking, the set might be wholly absent and so we use
269 #define symbol_set_declare(set) \
270 extern char const __start_##set[] __symbol_set_attribute; \
271 extern char const __stop_##set[] __symbol_set_attribute;
273 # define __symbol_set_attribute attribute_hidden
275 # define __symbol_set_attribute __attribute__ ((weak))
278 /* Return a pointer (void *const *) to the first element of SET. */
279 #define symbol_set_first_element(set) ((void *const *) (&__start_##set))
281 /* Return true iff PTR (a void *const *) has been incremented
282 past the last element in SET. */
283 #define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
285 /* Use symbol_version_reference to specify the version a symbol
286 reference should link to. Use symbol_version or
287 default_symbol_version for the definition of a versioned symbol.
288 The difference is that the latter is a no-op in non-shared
291 # define symbol_version_reference(real, name, version) \
292 .symver real, name##@##version
293 #else /* !__ASSEMBLER__ */
294 # define symbol_version_reference(real, name, version) \
295 __asm__ (".symver " #real "," #name "@" #version)
299 # define symbol_version(real, name, version) \
300 symbol_version_reference(real, name, version)
301 # define default_symbol_version(real, name, version) \
302 _default_symbol_version(real, name, version)
303 # ifdef __ASSEMBLER__
304 # define _default_symbol_version(real, name, version) \
305 .symver real, name##@##@##version
307 # define _default_symbol_version(real, name, version) \
308 __asm__ (".symver " #real "," #name "@@" #version)
311 # define symbol_version(real, name, version)
312 # define default_symbol_version(real, name, version) \
313 strong_alias(real, name)
316 #if defined SHARED || defined LIBC_NONSHARED
317 # define attribute_hidden __attribute__ ((visibility ("hidden")))
319 # define attribute_hidden
322 #define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
324 #define attribute_relro __attribute__ ((section (".data.rel.ro")))
326 /* The following macros are used for PLT bypassing within libc.so
327 (and if needed other libraries similarly).
328 First of all, you need to have the function prototyped somewhere,
333 If calls to foo within libc.so should always go to foo defined in libc.so,
334 then in include/foo.h you add:
336 libc_hidden_proto (foo)
338 line and after the foo function definition:
344 libc_hidden_def (foo)
352 libc_hidden_weak (foo)
354 Similarly for global data. If references to foo within libc.so should
355 always go to foo defined in libc.so, then in include/foo.h you add:
357 libc_hidden_proto (foo)
359 line and after foo's definition:
361 int foo = INITIAL_FOO_VALUE;
362 libc_hidden_data_def (foo)
366 int foo = INITIAL_FOO_VALUE;
367 libc_hidden_data_weak (foo)
369 If foo is normally just an alias (strong or weak) to some other function,
370 you should use the normal strong_alias first, then add libc_hidden_def
377 strong_alias (baz, foo)
378 libc_hidden_weak (foo)
380 If the function should be internal to multiple objects, say ld.so and
381 libc.so, the best way is to use:
383 #if IS_IN (libc) || IS_IN (rtld)
387 in include/foo.h and the normal macros at all function definitions
388 depending on what DSO they belong to.
390 If versioned_symbol macro is used to define foo,
391 libc_hidden_ver macro should be used, as in:
393 int __real_foo (int __bar)
397 versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
398 libc_hidden_ver (__real_foo, foo) */
400 #if defined SHARED && !defined NO_HIDDEN
401 # ifndef __ASSEMBLER__
402 # define __hidden_proto_hiddenattr(attrs...) \
403 __attribute__ ((visibility ("hidden"), ##attrs))
404 # define hidden_proto(name, attrs...) \
405 __hidden_proto (name, , __GI_##name, ##attrs)
406 # define hidden_tls_proto(name, attrs...) \
407 __hidden_proto (name, __thread, __GI_##name, ##attrs)
408 # define __hidden_proto(name, thread, internal, attrs...) \
409 extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
410 __hidden_proto_hiddenattr (attrs);
411 # define __hidden_asmname(name) \
412 __hidden_asmname1 (__USER_LABEL_PREFIX__, name)
413 # define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
414 # define __hidden_asmname2(prefix, name) #prefix name
415 # define __hidden_ver1(local, internal, name) \
416 extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
417 extern __typeof (name) __EI_##name \
418 __attribute__((alias (__hidden_asmname (#local))))
419 # define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
420 # define hidden_data_ver(local, name) hidden_ver(local, name)
421 # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
422 # define hidden_data_def(name) hidden_def(name)
423 # define hidden_weak(name) \
424 __hidden_ver1(__GI_##name, name, name) __attribute__((weak));
425 # define hidden_data_weak(name) hidden_weak(name)
426 # define hidden_nolink(name, lib, version) \
427 __hidden_nolink1 (__GI_##name, __EI_##name, name, VERSION_##lib##_##version)
428 # define __hidden_nolink1(local, internal, name, version) \
429 __hidden_nolink2 (local, internal, name, version)
430 # define __hidden_nolink2(local, internal, name, version) \
431 extern __typeof (name) internal __attribute__ ((alias (#local))); \
432 __hidden_nolink3 (local, internal, #name "@" #version)
433 # define __hidden_nolink3(local, internal, vername) \
434 __asm__ (".symver " #internal ", " vername);
436 /* For assembly, we need to do the opposite of what we do in C:
437 in assembly gcc __REDIRECT stuff is not in place, so functions
438 are defined by its normal name and we need to create the
439 __GI_* alias to it, in C __REDIRECT causes the function definition
440 to use __GI_* name and we need to add alias to the real name.
441 There is no reason to use hidden_weak over hidden_def in assembly,
442 but we provide it for consistency with the C usage.
443 hidden_proto doesn't make sense for assembly but the equivalent
444 is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */
445 # define hidden_def(name) strong_alias (name, __GI_##name)
446 # define hidden_weak(name) hidden_def (name)
447 # define hidden_ver(local, name) strong_alias (local, __GI_##name)
448 # define hidden_data_def(name) strong_data_alias (name, __GI_##name)
449 # define hidden_data_weak(name) hidden_data_def (name)
450 # define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
451 # define HIDDEN_JUMPTARGET(name) __GI_##name
454 # ifndef __ASSEMBLER__
455 # define hidden_proto(name, attrs...)
456 # define hidden_tls_proto(name, attrs...)
458 # define HIDDEN_JUMPTARGET(name) JUMPTARGET(name)
459 # endif /* Not __ASSEMBLER__ */
460 # define hidden_weak(name)
461 # define hidden_def(name)
462 # define hidden_ver(local, name)
463 # define hidden_data_weak(name)
464 # define hidden_data_def(name)
465 # define hidden_data_ver(local, name)
466 # define hidden_nolink(name, lib, version)
470 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
471 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
472 # define libc_hidden_def(name) hidden_def (name)
473 # define libc_hidden_weak(name) hidden_weak (name)
474 # ifdef LINK_OBSOLETE_RPC
475 /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */
476 # define libc_hidden_nolink_sunrpc(name, version) hidden_def (name)
478 # define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
480 # define libc_hidden_ver(local, name) hidden_ver (local, name)
481 # define libc_hidden_data_def(name) hidden_data_def (name)
482 # define libc_hidden_data_weak(name) hidden_data_weak (name)
483 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
485 # define libc_hidden_proto(name, attrs...)
486 # define libc_hidden_tls_proto(name, attrs...)
487 # define libc_hidden_def(name)
488 # define libc_hidden_weak(name)
489 # define libc_hidden_ver(local, name)
490 # define libc_hidden_data_def(name)
491 # define libc_hidden_data_weak(name)
492 # define libc_hidden_data_ver(local, name)
496 # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
497 # define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
498 # define rtld_hidden_def(name) hidden_def (name)
499 # define rtld_hidden_weak(name) hidden_weak (name)
500 # define rtld_hidden_ver(local, name) hidden_ver (local, name)
501 # define rtld_hidden_data_def(name) hidden_data_def (name)
502 # define rtld_hidden_data_weak(name) hidden_data_weak (name)
503 # define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name)
505 # define rtld_hidden_proto(name, attrs...)
506 # define rtld_hidden_tls_proto(name, attrs...)
507 # define rtld_hidden_def(name)
508 # define rtld_hidden_weak(name)
509 # define rtld_hidden_ver(local, name)
510 # define rtld_hidden_data_def(name)
511 # define rtld_hidden_data_weak(name)
512 # define rtld_hidden_data_ver(local, name)
516 # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
517 # define libm_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
518 # define libm_hidden_def(name) hidden_def (name)
519 # define libm_hidden_weak(name) hidden_weak (name)
520 # define libm_hidden_ver(local, name) hidden_ver (local, name)
521 # define libm_hidden_data_def(name) hidden_data_def (name)
522 # define libm_hidden_data_weak(name) hidden_data_weak (name)
523 # define libm_hidden_data_ver(local, name) hidden_data_ver (local, name)
525 # define libm_hidden_proto(name, attrs...)
526 # define libm_hidden_tls_proto(name, attrs...)
527 # define libm_hidden_def(name)
528 # define libm_hidden_weak(name)
529 # define libm_hidden_ver(local, name)
530 # define libm_hidden_data_def(name)
531 # define libm_hidden_data_weak(name)
532 # define libm_hidden_data_ver(local, name)
536 # define libmvec_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
537 # define libmvec_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
538 # define libmvec_hidden_def(name) hidden_def (name)
539 # define libmvec_hidden_weak(name) hidden_weak (name)
540 # define libmvec_hidden_ver(local, name) hidden_ver (local, name)
541 # define libmvec_hidden_data_def(name) hidden_data_def (name)
542 # define libmvec_hidden_data_weak(name) hidden_data_weak (name)
543 # define libmvec_hidden_data_ver(local, name) hidden_data_ver (local, name)
545 # define libmvec_hidden_proto(name, attrs...)
546 # define libmvec_hidden_tls_proto(name, attrs...)
547 # define libmvec_hidden_def(name)
548 # define libmvec_hidden_weak(name)
549 # define libmvec_hidden_ver(local, name)
550 # define libmvec_hidden_data_def(name)
551 # define libmvec_hidden_data_weak(name)
552 # define libmvec_hidden_data_ver(local, name)
555 #if IS_IN (libresolv)
556 # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
557 # define libresolv_hidden_tls_proto(name, attrs...) \
558 hidden_tls_proto (name, ##attrs)
559 # define libresolv_hidden_def(name) hidden_def (name)
560 # define libresolv_hidden_weak(name) hidden_weak (name)
561 # define libresolv_hidden_ver(local, name) hidden_ver (local, name)
562 # define libresolv_hidden_data_def(name) hidden_data_def (name)
563 # define libresolv_hidden_data_weak(name) hidden_data_weak (name)
564 # define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name)
566 # define libresolv_hidden_proto(name, attrs...)
567 # define libresolv_hidden_tls_proto(name, attrs...)
568 # define libresolv_hidden_def(name)
569 # define libresolv_hidden_weak(name)
570 # define libresolv_hidden_ver(local, name)
571 # define libresolv_hidden_data_def(name)
572 # define libresolv_hidden_data_weak(name)
573 # define libresolv_hidden_data_ver(local, name)
577 # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
578 # define librt_hidden_tls_proto(name, attrs...) \
579 hidden_tls_proto (name, ##attrs)
580 # define librt_hidden_def(name) hidden_def (name)
581 # define librt_hidden_weak(name) hidden_weak (name)
582 # define librt_hidden_ver(local, name) hidden_ver (local, name)
583 # define librt_hidden_data_def(name) hidden_data_def (name)
584 # define librt_hidden_data_weak(name) hidden_data_weak (name)
585 # define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
587 # define librt_hidden_proto(name, attrs...)
588 # define librt_hidden_tls_proto(name, attrs...)
589 # define librt_hidden_def(name)
590 # define librt_hidden_weak(name)
591 # define librt_hidden_ver(local, name)
592 # define librt_hidden_data_def(name)
593 # define librt_hidden_data_weak(name)
594 # define librt_hidden_data_ver(local, name)
598 # define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
599 # define libdl_hidden_tls_proto(name, attrs...) \
600 hidden_tls_proto (name, ##attrs)
601 # define libdl_hidden_def(name) hidden_def (name)
602 # define libdl_hidden_weak(name) hidden_weak (name)
603 # define libdl_hidden_ver(local, name) hidden_ver (local, name)
604 # define libdl_hidden_data_def(name) hidden_data_def (name)
605 # define libdl_hidden_data_weak(name) hidden_data_weak (name)
606 # define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name)
608 # define libdl_hidden_proto(name, attrs...)
609 # define libdl_hidden_tls_proto(name, attrs...)
610 # define libdl_hidden_def(name)
611 # define libdl_hidden_weak(name)
612 # define libdl_hidden_ver(local, name)
613 # define libdl_hidden_data_def(name)
614 # define libdl_hidden_data_weak(name)
615 # define libdl_hidden_data_ver(local, name)
618 #if IS_IN (libnss_files)
619 # define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
620 # define libnss_files_hidden_tls_proto(name, attrs...) \
621 hidden_tls_proto (name, ##attrs)
622 # define libnss_files_hidden_def(name) hidden_def (name)
623 # define libnss_files_hidden_weak(name) hidden_weak (name)
624 # define libnss_files_hidden_ver(local, name) hidden_ver (local, name)
625 # define libnss_files_hidden_data_def(name) hidden_data_def (name)
626 # define libnss_files_hidden_data_weak(name) hidden_data_weak (name)
627 # define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name)
629 # define libnss_files_hidden_proto(name, attrs...)
630 # define libnss_files_hidden_tls_proto(name, attrs...)
631 # define libnss_files_hidden_def(name)
632 # define libnss_files_hidden_weak(name)
633 # define libnss_files_hidden_ver(local, name)
634 # define libnss_files_hidden_data_def(name)
635 # define libnss_files_hidden_data_weak(name)
636 # define libnss_files_hidden_data_ver(local, name)
640 # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
641 # define libnsl_hidden_tls_proto(name, attrs...) \
642 hidden_tls_proto (name, ##attrs)
643 # define libnsl_hidden_def(name) hidden_def (name)
644 # define libnsl_hidden_weak(name) hidden_weak (name)
645 # define libnsl_hidden_ver(local, name) hidden_ver (local, name)
646 # define libnsl_hidden_data_def(name) hidden_data_def (name)
647 # define libnsl_hidden_data_weak(name) hidden_data_weak (name)
648 # define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name)
650 # define libnsl_hidden_proto(name, attrs...)
651 # define libnsl_hidden_tls_proto(name, attrs...)
652 # define libnsl_hidden_def(name)
653 # define libnsl_hidden_weak(name)
654 # define libnsl_hidden_ver(local, name)
655 # define libnsl_hidden_data_def(name)
656 # define libnsl_hidden_data_weak(name)
657 # define libnsl_hidden_data_ver(local, name)
660 #if IS_IN (libnss_nisplus)
661 # define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
662 # define libnss_nisplus_hidden_tls_proto(name, attrs...) \
663 hidden_tls_proto (name, ##attrs)
664 # define libnss_nisplus_hidden_def(name) hidden_def (name)
665 # define libnss_nisplus_hidden_weak(name) hidden_weak (name)
666 # define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name)
667 # define libnss_nisplus_hidden_data_def(name) hidden_data_def (name)
668 # define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name)
669 # define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name)
671 # define libnss_nisplus_hidden_proto(name, attrs...)
672 # define libnss_nisplus_hidden_tls_proto(name, attrs...)
673 # define libnss_nisplus_hidden_def(name)
674 # define libnss_nisplus_hidden_weak(name)
675 # define libnss_nisplus_hidden_ver(local, name)
676 # define libnss_nisplus_hidden_data_def(name)
677 # define libnss_nisplus_hidden_data_weak(name)
678 # define libnss_nisplus_hidden_data_ver(local, name)
681 #define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
682 #define libc_hidden_builtin_def(name) libc_hidden_def (name)
683 #define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
684 #define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
686 # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
690 # define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
691 # define libutil_hidden_tls_proto(name, attrs...) \
692 hidden_tls_proto (name, ##attrs)
693 # define libutil_hidden_def(name) hidden_def (name)
694 # define libutil_hidden_weak(name) hidden_weak (name)
695 # define libutil_hidden_ver(local, name) hidden_ver (local, name)
696 # define libutil_hidden_data_def(name) hidden_data_def (name)
697 # define libutil_hidden_data_weak(name) hidden_data_weak (name)
698 # define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name)
700 # define libutil_hidden_proto(name, attrs...)
701 # define libutil_hidden_tls_proto(name, attrs...)
702 # define libutil_hidden_def(name)
703 # define libutil_hidden_weak(name)
704 # define libutil_hidden_ver(local, name)
705 # define libutil_hidden_data_def(name)
706 # define libutil_hidden_data_weak(name)
707 # define libutil_hidden_data_ver(local, name)
710 /* Get some dirty hacks. */
711 #include <symbol-hacks.h>
713 /* Move compatibility symbols out of the way by placing them all in a
715 #ifndef __ASSEMBLER__
716 # define attribute_compat_text_section \
717 __attribute__ ((section (".text.compat")))
718 # define attribute_compat_data_section \
719 __attribute__ ((section (".data.compat")))
721 # define compat_text_section .section ".text.compat", "ax";
722 # define compat_data_section .section ".data.compat", "aw";
725 /* Marker used for indirection function symbols. */
726 #define libc_ifunc(name, expr) \
727 extern void *name##_ifunc (void) __asm__ (#name); \
728 void *name##_ifunc (void) \
731 __typeof (name) *res = expr; \
734 __asm__ (".type " #name ", %gnu_indirect_function");
736 /* The body of the function is supposed to use __get_cpu_features
737 which will, if necessary, initialize the data first. */
738 #define libm_ifunc(name, expr) \
739 extern void *name##_ifunc (void) __asm__ (#name); \
740 void *name##_ifunc (void) \
742 __typeof (name) *res = expr; \
745 __asm__ (".type " #name ", %gnu_indirect_function");
747 #ifdef HAVE_ASM_SET_DIRECTIVE
748 # define libc_ifunc_hidden_def1(local, name) \
749 __asm__ (".globl " #local "\n\t" \
750 ".hidden " #local "\n\t" \
751 ".set " #local ", " #name);
753 # define libc_ifunc_hidden_def1(local, name) \
754 __asm__ (".globl " #local "\n\t" \
755 ".hidden " #local "\n\t" \
759 #define libc_ifunc_hidden_def(name) \
760 libc_ifunc_hidden_def1 (__GI_##name, name)
762 /* Add the compiler optimization to inhibit loop transformation to library
763 calls. This is used to avoid recursive calls in memset and memmove
764 default implementations. */
765 #ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
766 # define inhibit_loop_to_libcall \
767 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
769 # define inhibit_loop_to_libcall
772 #endif /* libc-symbols.h */