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)
286 # define symbol_version(real, name, version) \
287 _symbol_version(real, name, version)
288 # define default_symbol_version(real, name, version) \
289 _default_symbol_version(real, name, version)
290 # ifdef __ASSEMBLER__
291 # define _symbol_version(real, name, version) \
292 .symver real, name##@##version
293 # define _default_symbol_version(real, name, version) \
294 .symver real, name##@##@##version
296 # define _symbol_version(real, name, version) \
297 __asm__ (".symver " #real "," #name "@" #version)
298 # define _default_symbol_version(real, name, version) \
299 __asm__ (".symver " #real "," #name "@@" #version)
302 # define symbol_version(real, name, version)
303 # define default_symbol_version(real, name, version) \
304 strong_alias(real, name)
307 #if defined SHARED || defined LIBC_NONSHARED
308 # define attribute_hidden __attribute__ ((visibility ("hidden")))
310 # define attribute_hidden
313 #define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
315 #define attribute_relro __attribute__ ((section (".data.rel.ro")))
317 /* The following macros are used for PLT bypassing within libc.so
318 (and if needed other libraries similarly).
319 First of all, you need to have the function prototyped somewhere,
324 If calls to foo within libc.so should always go to foo defined in libc.so,
325 then in include/foo.h you add:
327 libc_hidden_proto (foo)
329 line and after the foo function definition:
335 libc_hidden_def (foo)
343 libc_hidden_weak (foo)
345 Similarly for global data. If references to foo within libc.so should
346 always go to foo defined in libc.so, then in include/foo.h you add:
348 libc_hidden_proto (foo)
350 line and after foo's definition:
352 int foo = INITIAL_FOO_VALUE;
353 libc_hidden_data_def (foo)
357 int foo = INITIAL_FOO_VALUE;
358 libc_hidden_data_weak (foo)
360 If foo is normally just an alias (strong or weak) to some other function,
361 you should use the normal strong_alias first, then add libc_hidden_def
368 strong_alias (baz, foo)
369 libc_hidden_weak (foo)
371 If the function should be internal to multiple objects, say ld.so and
372 libc.so, the best way is to use:
374 #if IS_IN (libc) || IS_IN (rtld)
378 in include/foo.h and the normal macros at all function definitions
379 depending on what DSO they belong to.
381 If versioned_symbol macro is used to define foo,
382 libc_hidden_ver macro should be used, as in:
384 int __real_foo (int __bar)
388 versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
389 libc_hidden_ver (__real_foo, foo) */
391 #if defined SHARED && !defined NO_HIDDEN
392 # ifndef __ASSEMBLER__
393 # define __hidden_proto_hiddenattr(attrs...) \
394 __attribute__ ((visibility ("hidden"), ##attrs))
395 # define hidden_proto(name, attrs...) \
396 __hidden_proto (name, , __GI_##name, ##attrs)
397 # define hidden_tls_proto(name, attrs...) \
398 __hidden_proto (name, __thread, __GI_##name, ##attrs)
399 # define __hidden_proto(name, thread, internal, attrs...) \
400 extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
401 __hidden_proto_hiddenattr (attrs);
402 # define __hidden_asmname(name) \
403 __hidden_asmname1 (__USER_LABEL_PREFIX__, name)
404 # define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
405 # define __hidden_asmname2(prefix, name) #prefix name
406 # define __hidden_ver1(local, internal, name) \
407 extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
408 extern __typeof (name) __EI_##name \
409 __attribute__((alias (__hidden_asmname (#local))))
410 # define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
411 # define hidden_data_ver(local, name) hidden_ver(local, name)
412 # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
413 # define hidden_data_def(name) hidden_def(name)
414 # define hidden_weak(name) \
415 __hidden_ver1(__GI_##name, name, name) __attribute__((weak));
416 # define hidden_data_weak(name) hidden_weak(name)
417 # define hidden_nolink(name, lib, version) \
418 __hidden_nolink1 (__GI_##name, __EI_##name, name, VERSION_##lib##_##version)
419 # define __hidden_nolink1(local, internal, name, version) \
420 __hidden_nolink2 (local, internal, name, version)
421 # define __hidden_nolink2(local, internal, name, version) \
422 extern __typeof (name) internal __attribute__ ((alias (#local))); \
423 __hidden_nolink3 (local, internal, #name "@" #version)
424 # define __hidden_nolink3(local, internal, vername) \
425 __asm__ (".symver " #internal ", " vername);
427 /* For assembly, we need to do the opposite of what we do in C:
428 in assembly gcc __REDIRECT stuff is not in place, so functions
429 are defined by its normal name and we need to create the
430 __GI_* alias to it, in C __REDIRECT causes the function definition
431 to use __GI_* name and we need to add alias to the real name.
432 There is no reason to use hidden_weak over hidden_def in assembly,
433 but we provide it for consistency with the C usage.
434 hidden_proto doesn't make sense for assembly but the equivalent
435 is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */
436 # define hidden_def(name) strong_alias (name, __GI_##name)
437 # define hidden_weak(name) hidden_def (name)
438 # define hidden_ver(local, name) strong_alias (local, __GI_##name)
439 # define hidden_data_def(name) strong_data_alias (name, __GI_##name)
440 # define hidden_data_weak(name) hidden_data_def (name)
441 # define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
442 # define HIDDEN_JUMPTARGET(name) __GI_##name
445 # ifndef __ASSEMBLER__
446 # define hidden_proto(name, attrs...)
447 # define hidden_tls_proto(name, attrs...)
449 # define HIDDEN_JUMPTARGET(name) JUMPTARGET(name)
450 # endif /* Not __ASSEMBLER__ */
451 # define hidden_weak(name)
452 # define hidden_def(name)
453 # define hidden_ver(local, name)
454 # define hidden_data_weak(name)
455 # define hidden_data_def(name)
456 # define hidden_data_ver(local, name)
457 # define hidden_nolink(name, lib, version)
461 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
462 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
463 # define libc_hidden_def(name) hidden_def (name)
464 # define libc_hidden_weak(name) hidden_weak (name)
465 # ifdef LINK_OBSOLETE_RPC
466 /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */
467 # define libc_hidden_nolink_sunrpc(name, version) hidden_def (name)
469 # define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
471 # define libc_hidden_ver(local, name) hidden_ver (local, name)
472 # define libc_hidden_data_def(name) hidden_data_def (name)
473 # define libc_hidden_data_weak(name) hidden_data_weak (name)
474 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
476 # define libc_hidden_proto(name, attrs...)
477 # define libc_hidden_tls_proto(name, attrs...)
478 # define libc_hidden_def(name)
479 # define libc_hidden_weak(name)
480 # define libc_hidden_ver(local, name)
481 # define libc_hidden_data_def(name)
482 # define libc_hidden_data_weak(name)
483 # define libc_hidden_data_ver(local, name)
487 # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
488 # define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
489 # define rtld_hidden_def(name) hidden_def (name)
490 # define rtld_hidden_weak(name) hidden_weak (name)
491 # define rtld_hidden_ver(local, name) hidden_ver (local, name)
492 # define rtld_hidden_data_def(name) hidden_data_def (name)
493 # define rtld_hidden_data_weak(name) hidden_data_weak (name)
494 # define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name)
496 # define rtld_hidden_proto(name, attrs...)
497 # define rtld_hidden_tls_proto(name, attrs...)
498 # define rtld_hidden_def(name)
499 # define rtld_hidden_weak(name)
500 # define rtld_hidden_ver(local, name)
501 # define rtld_hidden_data_def(name)
502 # define rtld_hidden_data_weak(name)
503 # define rtld_hidden_data_ver(local, name)
507 # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
508 # define libm_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
509 # define libm_hidden_def(name) hidden_def (name)
510 # define libm_hidden_weak(name) hidden_weak (name)
511 # define libm_hidden_ver(local, name) hidden_ver (local, name)
512 # define libm_hidden_data_def(name) hidden_data_def (name)
513 # define libm_hidden_data_weak(name) hidden_data_weak (name)
514 # define libm_hidden_data_ver(local, name) hidden_data_ver (local, name)
516 # define libm_hidden_proto(name, attrs...)
517 # define libm_hidden_tls_proto(name, attrs...)
518 # define libm_hidden_def(name)
519 # define libm_hidden_weak(name)
520 # define libm_hidden_ver(local, name)
521 # define libm_hidden_data_def(name)
522 # define libm_hidden_data_weak(name)
523 # define libm_hidden_data_ver(local, name)
527 # define libmvec_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
528 # define libmvec_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
529 # define libmvec_hidden_def(name) hidden_def (name)
530 # define libmvec_hidden_weak(name) hidden_weak (name)
531 # define libmvec_hidden_ver(local, name) hidden_ver (local, name)
532 # define libmvec_hidden_data_def(name) hidden_data_def (name)
533 # define libmvec_hidden_data_weak(name) hidden_data_weak (name)
534 # define libmvec_hidden_data_ver(local, name) hidden_data_ver (local, name)
536 # define libmvec_hidden_proto(name, attrs...)
537 # define libmvec_hidden_tls_proto(name, attrs...)
538 # define libmvec_hidden_def(name)
539 # define libmvec_hidden_weak(name)
540 # define libmvec_hidden_ver(local, name)
541 # define libmvec_hidden_data_def(name)
542 # define libmvec_hidden_data_weak(name)
543 # define libmvec_hidden_data_ver(local, name)
546 #if IS_IN (libresolv)
547 # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
548 # define libresolv_hidden_tls_proto(name, attrs...) \
549 hidden_tls_proto (name, ##attrs)
550 # define libresolv_hidden_def(name) hidden_def (name)
551 # define libresolv_hidden_weak(name) hidden_weak (name)
552 # define libresolv_hidden_ver(local, name) hidden_ver (local, name)
553 # define libresolv_hidden_data_def(name) hidden_data_def (name)
554 # define libresolv_hidden_data_weak(name) hidden_data_weak (name)
555 # define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name)
557 # define libresolv_hidden_proto(name, attrs...)
558 # define libresolv_hidden_tls_proto(name, attrs...)
559 # define libresolv_hidden_def(name)
560 # define libresolv_hidden_weak(name)
561 # define libresolv_hidden_ver(local, name)
562 # define libresolv_hidden_data_def(name)
563 # define libresolv_hidden_data_weak(name)
564 # define libresolv_hidden_data_ver(local, name)
568 # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
569 # define librt_hidden_tls_proto(name, attrs...) \
570 hidden_tls_proto (name, ##attrs)
571 # define librt_hidden_def(name) hidden_def (name)
572 # define librt_hidden_weak(name) hidden_weak (name)
573 # define librt_hidden_ver(local, name) hidden_ver (local, name)
574 # define librt_hidden_data_def(name) hidden_data_def (name)
575 # define librt_hidden_data_weak(name) hidden_data_weak (name)
576 # define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
578 # define librt_hidden_proto(name, attrs...)
579 # define librt_hidden_tls_proto(name, attrs...)
580 # define librt_hidden_def(name)
581 # define librt_hidden_weak(name)
582 # define librt_hidden_ver(local, name)
583 # define librt_hidden_data_def(name)
584 # define librt_hidden_data_weak(name)
585 # define librt_hidden_data_ver(local, name)
589 # define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
590 # define libdl_hidden_tls_proto(name, attrs...) \
591 hidden_tls_proto (name, ##attrs)
592 # define libdl_hidden_def(name) hidden_def (name)
593 # define libdl_hidden_weak(name) hidden_weak (name)
594 # define libdl_hidden_ver(local, name) hidden_ver (local, name)
595 # define libdl_hidden_data_def(name) hidden_data_def (name)
596 # define libdl_hidden_data_weak(name) hidden_data_weak (name)
597 # define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name)
599 # define libdl_hidden_proto(name, attrs...)
600 # define libdl_hidden_tls_proto(name, attrs...)
601 # define libdl_hidden_def(name)
602 # define libdl_hidden_weak(name)
603 # define libdl_hidden_ver(local, name)
604 # define libdl_hidden_data_def(name)
605 # define libdl_hidden_data_weak(name)
606 # define libdl_hidden_data_ver(local, name)
609 #if IS_IN (libnss_files)
610 # define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
611 # define libnss_files_hidden_tls_proto(name, attrs...) \
612 hidden_tls_proto (name, ##attrs)
613 # define libnss_files_hidden_def(name) hidden_def (name)
614 # define libnss_files_hidden_weak(name) hidden_weak (name)
615 # define libnss_files_hidden_ver(local, name) hidden_ver (local, name)
616 # define libnss_files_hidden_data_def(name) hidden_data_def (name)
617 # define libnss_files_hidden_data_weak(name) hidden_data_weak (name)
618 # define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name)
620 # define libnss_files_hidden_proto(name, attrs...)
621 # define libnss_files_hidden_tls_proto(name, attrs...)
622 # define libnss_files_hidden_def(name)
623 # define libnss_files_hidden_weak(name)
624 # define libnss_files_hidden_ver(local, name)
625 # define libnss_files_hidden_data_def(name)
626 # define libnss_files_hidden_data_weak(name)
627 # define libnss_files_hidden_data_ver(local, name)
631 # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
632 # define libnsl_hidden_tls_proto(name, attrs...) \
633 hidden_tls_proto (name, ##attrs)
634 # define libnsl_hidden_def(name) hidden_def (name)
635 # define libnsl_hidden_weak(name) hidden_weak (name)
636 # define libnsl_hidden_ver(local, name) hidden_ver (local, name)
637 # define libnsl_hidden_data_def(name) hidden_data_def (name)
638 # define libnsl_hidden_data_weak(name) hidden_data_weak (name)
639 # define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name)
641 # define libnsl_hidden_proto(name, attrs...)
642 # define libnsl_hidden_tls_proto(name, attrs...)
643 # define libnsl_hidden_def(name)
644 # define libnsl_hidden_weak(name)
645 # define libnsl_hidden_ver(local, name)
646 # define libnsl_hidden_data_def(name)
647 # define libnsl_hidden_data_weak(name)
648 # define libnsl_hidden_data_ver(local, name)
651 #if IS_IN (libnss_nisplus)
652 # define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
653 # define libnss_nisplus_hidden_tls_proto(name, attrs...) \
654 hidden_tls_proto (name, ##attrs)
655 # define libnss_nisplus_hidden_def(name) hidden_def (name)
656 # define libnss_nisplus_hidden_weak(name) hidden_weak (name)
657 # define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name)
658 # define libnss_nisplus_hidden_data_def(name) hidden_data_def (name)
659 # define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name)
660 # define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name)
662 # define libnss_nisplus_hidden_proto(name, attrs...)
663 # define libnss_nisplus_hidden_tls_proto(name, attrs...)
664 # define libnss_nisplus_hidden_def(name)
665 # define libnss_nisplus_hidden_weak(name)
666 # define libnss_nisplus_hidden_ver(local, name)
667 # define libnss_nisplus_hidden_data_def(name)
668 # define libnss_nisplus_hidden_data_weak(name)
669 # define libnss_nisplus_hidden_data_ver(local, name)
672 #define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
673 #define libc_hidden_builtin_def(name) libc_hidden_def (name)
674 #define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
675 #define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
677 # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
681 # define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
682 # define libutil_hidden_tls_proto(name, attrs...) \
683 hidden_tls_proto (name, ##attrs)
684 # define libutil_hidden_def(name) hidden_def (name)
685 # define libutil_hidden_weak(name) hidden_weak (name)
686 # define libutil_hidden_ver(local, name) hidden_ver (local, name)
687 # define libutil_hidden_data_def(name) hidden_data_def (name)
688 # define libutil_hidden_data_weak(name) hidden_data_weak (name)
689 # define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name)
691 # define libutil_hidden_proto(name, attrs...)
692 # define libutil_hidden_tls_proto(name, attrs...)
693 # define libutil_hidden_def(name)
694 # define libutil_hidden_weak(name)
695 # define libutil_hidden_ver(local, name)
696 # define libutil_hidden_data_def(name)
697 # define libutil_hidden_data_weak(name)
698 # define libutil_hidden_data_ver(local, name)
701 /* Get some dirty hacks. */
702 #include <symbol-hacks.h>
704 /* Move compatibility symbols out of the way by placing them all in a
706 #ifndef __ASSEMBLER__
707 # define attribute_compat_text_section \
708 __attribute__ ((section (".text.compat")))
709 # define attribute_compat_data_section \
710 __attribute__ ((section (".data.compat")))
712 # define compat_text_section .section ".text.compat", "ax";
713 # define compat_data_section .section ".data.compat", "aw";
716 /* Marker used for indirection function symbols. */
717 #define libc_ifunc(name, expr) \
718 extern void *name##_ifunc (void) __asm__ (#name); \
719 void *name##_ifunc (void) \
722 __typeof (name) *res = expr; \
725 __asm__ (".type " #name ", %gnu_indirect_function");
727 /* The body of the function is supposed to use __get_cpu_features
728 which will, if necessary, initialize the data first. */
729 #define libm_ifunc(name, expr) \
730 extern void *name##_ifunc (void) __asm__ (#name); \
731 void *name##_ifunc (void) \
733 __typeof (name) *res = expr; \
736 __asm__ (".type " #name ", %gnu_indirect_function");
738 #ifdef HAVE_ASM_SET_DIRECTIVE
739 # define libc_ifunc_hidden_def1(local, name) \
740 __asm__ (".globl " #local "\n\t" \
741 ".hidden " #local "\n\t" \
742 ".set " #local ", " #name);
744 # define libc_ifunc_hidden_def1(local, name) \
745 __asm__ (".globl " #local "\n\t" \
746 ".hidden " #local "\n\t" \
750 #define libc_ifunc_hidden_def(name) \
751 libc_ifunc_hidden_def1 (__GI_##name, name)
753 /* Add the compiler optimization to inhibit loop transformation to library
754 calls. This is used to avoid recursive calls in memset and memmove
755 default implementations. */
756 #ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
757 # define inhibit_loop_to_libcall \
758 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
760 # define inhibit_loop_to_libcall
763 #endif /* libc-symbols.h */