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-2014 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 /* This file's macros are included implicitly in the compilation of every
24 file in the C library by -imacros.
26 We include config.h which is generated by configure.
27 It should define for us the following symbols:
29 * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
30 * HAVE_ASM_WEAK_DIRECTIVE if we have weak symbols using `.weak'.
31 * HAVE_ASM_WEAKEXT_DIRECTIVE if we have weak symbols using `.weakext'.
35 /* This is defined for the compilation of all C library code. features.h
36 tests this to avoid inclusion of stubs.h while compiling the library,
37 before stubs.h has been generated. Some library code that is shared
38 with other packages also tests this symbol to see if it is being
39 compiled as part of the C library. We must define this before including
40 config.h, because it makes some definitions conditional on whether libc
41 itself is being compiled, or just some generator program. */
44 /* Enable declarations of GNU extensions, since we are compiling them. */
46 /* And we also need the data for the reentrant functions. */
51 /* Define this for the benefit of portable GNU code that wants to check it.
52 Code that checks with #if will not #include <config.h> again, since we've
53 already done it (and this file is implicitly included in every compile,
54 via -include). Code that checks with #ifdef will #include <config.h>,
55 but that file should always be idempotent (i.e., it's just #define/#undef
56 and nothing else anywhere should be changing the macro state it touches),
58 #define HAVE_CONFIG_H 0
60 /* Define these macros for the benefit of portable GNU code that wants to check
61 them. Of course, STDC_HEADERS is never false when building libc! */
62 #define STDC_HEADERS 1
63 #define HAVE_MBSTATE_T 1
64 #define HAVE_MBSRTOWCS 1
65 #define HAVE_LIBINTL_H 1
66 #define HAVE_WCTYPE_H 1
67 #define HAVE_ISWCTYPE 1
70 /* The symbols in all the user (non-_) macros are C symbols. */
72 #if !defined HAVE_ASM_WEAK_DIRECTIVE && !defined HAVE_ASM_WEAKEXT_DIRECTIVE
73 # error "weak symbol support needed"
76 #ifndef __SYMBOL_PREFIX
77 # define __SYMBOL_PREFIX
81 # define C_SYMBOL_NAME(name) name
85 # define ASM_LINE_SEP ;
88 #ifdef HAVE_ASM_GLOBAL_DOT_NAME
89 # ifndef C_SYMBOL_DOT_NAME
90 # if defined __GNUC__ && defined __GNUC_MINOR__ \
91 && (__GNUC__ << 16) + __GNUC_MINOR__ >= (3 << 16) + 1
92 # define C_SYMBOL_DOT_NAME(name) .name
94 # define C_SYMBOL_DOT_NAME(name) .##name
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 # ifdef HAVE_ASM_GLOBAL_DOT_NAME
135 # define strong_alias(original, alias) \
136 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
137 .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) ASM_LINE_SEP \
138 .globl C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
139 .set C_SYMBOL_DOT_NAME (alias),C_SYMBOL_DOT_NAME (original)
140 # define strong_data_alias(original, alias) \
141 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
142 .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
144 # define strong_alias(original, alias) \
145 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
146 .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
147 # define strong_data_alias(original, alias) strong_alias(original, alias)
150 # ifdef HAVE_ASM_GLOBAL_DOT_NAME
151 # define strong_alias(original, alias) \
152 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
153 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
154 .globl C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
155 C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
156 # define strong_data_alias(original, alias) \
157 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
158 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
160 # define strong_alias(original, alias) \
161 .globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
162 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
163 # define strong_data_alias(original, alias) strong_alias(original, alias)
167 # ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
168 # ifdef HAVE_ASM_GLOBAL_DOT_NAME
169 # define weak_alias(original, alias) \
170 .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) ASM_LINE_SEP \
171 .weakext C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
173 # define weak_alias(original, alias) \
174 .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
176 # define weak_extern(symbol) \
177 .weakext C_SYMBOL_NAME (symbol)
179 # else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
181 # ifdef HAVE_ASM_GLOBAL_DOT_NAME
182 # define weak_alias(original, alias) \
183 .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
184 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
185 .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
186 C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
188 # define weak_alias(original, alias) \
189 .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
190 C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
193 # define weak_extern(symbol) \
194 .weak C_SYMBOL_NAME (symbol)
196 # endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
198 #endif /* __ASSEMBLER__ */
200 /* On some platforms we can make internal function calls (i.e., calls of
201 functions not exported) a bit faster by using a different calling
203 #ifndef internal_function
204 # define internal_function /* empty */
207 /* Determine the return address. */
208 #define RETURN_ADDRESS(nr) \
209 __builtin_extract_return_addr (__builtin_return_address (nr))
211 /* When a reference to SYMBOL is encountered, the linker will emit a
212 warning message MSG. */
213 /* We want the .gnu.warning.SYMBOL section to be unallocated. */
214 #ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
215 # define __make_section_unallocated(section_string) \
216 asm (".section " section_string "\n\t.previous");
217 #elif defined HAVE_ASM_POPSECTION_DIRECTIVE
218 # define __make_section_unallocated(section_string) \
219 asm (".pushsection " section_string "\n\t.popsection");
221 # define __make_section_unallocated(section_string)
224 /* Tacking on "\n\t#" to the section name makes gcc put it's bogus
225 section attributes on what looks like a comment to the assembler. */
226 #ifdef HAVE_SECTION_QUOTES
227 # define __sec_comment "\"\n\t#\""
229 # define __sec_comment "\n\t#"
231 #define link_warning(symbol, msg) \
232 __make_section_unallocated (".gnu.warning." #symbol) \
233 static const char __evoke_link_warning_##symbol[] \
234 __attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
236 #define libc_freeres_ptr(decl) \
237 __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
238 decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))
239 #define __libc_freeres_fn_section \
240 __attribute__ ((section ("__libc_freeres_fn")))
242 #define libc_freeres_fn(name) \
243 static void name (void) __attribute_used__ __libc_freeres_fn_section; \
244 text_set_element (__libc_subfreeres, name); \
245 static void name (void)
247 /* A canned warning for sysdeps/stub functions. */
248 #define stub_warning(name) \
249 __make_section_unallocated (".gnu.glibc-stub." #name) \
250 link_warning (name, #name " is not implemented and will always fail")
252 /* Warning for linking functions calling dlopen into static binaries. */
254 #define static_link_warning(name)
256 #define static_link_warning(name) static_link_warning1(name)
257 #define static_link_warning1(name) \
258 link_warning(name, "Using '" #name "' in statically linked applications \
259 requires at runtime the shared libraries from the glibc version used \
263 /* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
264 alias to ORIGINAL, when the assembler supports such declarations
266 This is only necessary when defining something in assembly, or playing
267 funny alias games where the size should be other than what the compiler
269 #define declare_symbol_alias(symbol, original, type, size) \
270 declare_symbol_alias_1 (symbol, original, type, size)
272 # define declare_symbol_alias_1(symbol, original, type, size) \
273 strong_alias (original, symbol); \
274 .type C_SYMBOL_NAME (symbol), %##type; \
275 .size C_SYMBOL_NAME (symbol), size
276 #else /* Not __ASSEMBLER__. */
277 # define declare_symbol_alias_1(symbol, original, type, size) \
278 asm (".globl " __SYMBOL_PREFIX #symbol \
279 "\n\t" declare_symbol_alias_1_alias (symbol, original) \
280 "\n\t.type " __SYMBOL_PREFIX #symbol ", " \
282 "\n\t.size " __SYMBOL_PREFIX #symbol ", " #size);
283 # ifdef HAVE_ASM_SET_DIRECTIVE
284 # define declare_symbol_alias_1_alias(symbol, original) \
285 ".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX #original
287 # define declare_symbol_alias_1_alias(symbol, original) \
288 __SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX #original
289 # endif /* HAVE_ASM_SET_DIRECTIVE */
290 #endif /* __ASSEMBLER__ */
297 /* Symbol set support macros. */
299 /* Make SYMBOL, which is in the text segment, an element of SET. */
300 #define text_set_element(set, symbol) _elf_set_element(set, symbol)
301 /* Make SYMBOL, which is in the data segment, an element of SET. */
302 #define data_set_element(set, symbol) _elf_set_element(set, symbol)
303 /* Make SYMBOL, which is in the bss segment, an element of SET. */
304 #define bss_set_element(set, symbol) _elf_set_element(set, symbol)
306 /* These are all done the same way in ELF.
307 There is a new section created for each set. */
309 /* When building a shared library, make the set section writable,
310 because it will need to be relocated at run time anyway. */
311 # define _elf_set_element(set, symbol) \
312 static const void *__elf_set_##set##_element_##symbol##__ \
313 __attribute__ ((used, section (#set))) = &(symbol)
315 # define _elf_set_element(set, symbol) \
316 static const void *const __elf_set_##set##_element_##symbol##__ \
317 __attribute__ ((used, section (#set))) = &(symbol)
320 /* Define SET as a symbol set. This may be required (it is in a.out) to
321 be able to use the set's contents. */
322 #define symbol_set_define(set) symbol_set_declare(set)
324 /* Declare SET for use in this module, if defined in another module.
325 In a shared library, this is always local to that shared object.
326 For static linking, the set might be wholly absent and so we use
328 #define symbol_set_declare(set) \
329 extern char const __start_##set[] __symbol_set_attribute; \
330 extern char const __stop_##set[] __symbol_set_attribute;
332 # define __symbol_set_attribute attribute_hidden
334 # define __symbol_set_attribute __attribute__ ((weak))
337 /* Return a pointer (void *const *) to the first element of SET. */
338 #define symbol_set_first_element(set) ((void *const *) (&__start_##set))
340 /* Return true iff PTR (a void *const *) has been incremented
341 past the last element in SET. */
342 #define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
345 # define symbol_version(real, name, version) \
346 _symbol_version(real, name, version)
347 # define default_symbol_version(real, name, version) \
348 _default_symbol_version(real, name, version)
349 # ifdef __ASSEMBLER__
350 # ifdef HAVE_ASM_GLOBAL_DOT_NAME
351 # define _symbol_version(real, name, version) \
352 .symver real, name##@##version ASM_LINE_SEP \
353 .symver C_SYMBOL_DOT_NAME(real), C_SYMBOL_DOT_NAME(name##@##version)
354 # define _default_symbol_version(real, name, version) \
355 .symver real, name##@##@##version ASM_LINE_SEP \
356 .symver C_SYMBOL_DOT_NAME(real), C_SYMBOL_DOT_NAME(name##@##@##version)
358 # define _symbol_version(real, name, version) \
359 .symver real, name##@##version
360 # define _default_symbol_version(real, name, version) \
361 .symver real, name##@##@##version
364 # ifdef HAVE_ASM_GLOBAL_DOT_NAME
365 # define _symbol_version(real, name, version) \
366 __asm__ (".symver " #real "," #name "@" #version "\n\t" \
367 ".symver ." #real ",." #name "@" #version)
368 # define _default_symbol_version(real, name, version) \
369 __asm__ (".symver " #real "," #name "@@" #version "\n\t" \
370 ".symver ." #real ",." #name "@@" #version)
372 # define _symbol_version(real, name, version) \
373 __asm__ (".symver " #real "," #name "@" #version)
374 # define _default_symbol_version(real, name, version) \
375 __asm__ (".symver " #real "," #name "@@" #version)
379 # define symbol_version(real, name, version)
380 # define default_symbol_version(real, name, version) \
381 strong_alias(real, name)
384 #if defined SHARED || defined LIBC_NONSHARED
385 # define attribute_hidden __attribute__ ((visibility ("hidden")))
387 # define attribute_hidden
390 #define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
392 #define attribute_relro __attribute__ ((section (".data.rel.ro")))
394 /* Handling on non-exported internal names. We have to do this only
397 # define INTUSE(name) name##_internal
398 # define INTDEF(name) strong_alias (name, name##_internal)
399 # define INTVARDEF(name) \
400 _INTVARDEF (name, name##_internal)
401 # define _INTVARDEF(name, aliasname) \
402 extern __typeof (name) aliasname __attribute__ ((alias (#name), \
403 visibility ("hidden")));
404 # define INTDEF2(name, newname) strong_alias (name, newname##_internal)
405 # define INTVARDEF2(name, newname) _INTVARDEF (name, newname##_internal)
407 # define INTUSE(name) name
408 # define INTDEF(name)
409 # define INTVARDEF(name)
410 # define INTDEF2(name, newname)
411 # define INTVARDEF2(name, newname)
414 /* The following macros are used for PLT bypassing within libc.so
415 (and if needed other libraries similarly).
416 First of all, you need to have the function prototyped somewhere,
421 If calls to foo within libc.so should always go to foo defined in libc.so,
422 then in include/foo.h you add:
424 libc_hidden_proto (foo)
426 line and after the foo function definition:
432 libc_hidden_def (foo)
440 libc_hidden_weak (foo)
442 Similarly for global data. If references to foo within libc.so should
443 always go to foo defined in libc.so, then in include/foo.h you add:
445 libc_hidden_proto (foo)
447 line and after foo's definition:
449 int foo = INITIAL_FOO_VALUE;
450 libc_hidden_data_def (foo)
454 int foo = INITIAL_FOO_VALUE;
455 libc_hidden_data_weak (foo)
457 If foo is normally just an alias (strong or weak) to some other function,
458 you should use the normal strong_alias first, then add libc_hidden_def
465 strong_alias (baz, foo)
466 libc_hidden_weak (foo)
468 If the function should be internal to multiple objects, say ld.so and
469 libc.so, the best way is to use:
471 #if !defined NOT_IN_libc || defined IS_IN_rtld
475 in include/foo.h and the normal macros at all function definitions
476 depending on what DSO they belong to.
478 If versioned_symbol macro is used to define foo,
479 libc_hidden_ver macro should be used, as in:
481 int __real_foo (int __bar)
485 versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
486 libc_hidden_ver (__real_foo, foo) */
488 #if defined SHARED && !defined NO_HIDDEN
489 # ifndef __ASSEMBLER__
490 # define __hidden_proto_hiddenattr(attrs...) \
491 __attribute__ ((visibility ("hidden"), ##attrs))
492 # define hidden_proto(name, attrs...) \
493 __hidden_proto (name, , __GI_##name, ##attrs)
494 # define hidden_tls_proto(name, attrs...) \
495 __hidden_proto (name, __thread, __GI_##name, ##attrs)
496 # define __hidden_proto(name, thread, internal, attrs...) \
497 extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
498 __hidden_proto_hiddenattr (attrs);
499 # define __hidden_asmname(name) \
500 __hidden_asmname1 (__USER_LABEL_PREFIX__, name)
501 # define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
502 # define __hidden_asmname2(prefix, name) #prefix name
503 # define __hidden_ver1(local, internal, name) \
504 extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
505 extern __typeof (name) __EI_##name \
506 __attribute__((alias (__hidden_asmname (#local))))
507 # define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
508 # define hidden_data_ver(local, name) hidden_ver(local, name)
509 # define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
510 # define hidden_data_def(name) hidden_def(name)
511 # define hidden_weak(name) \
512 __hidden_ver1(__GI_##name, name, name) __attribute__((weak));
513 # define hidden_data_weak(name) hidden_weak(name)
514 # define hidden_nolink(name, lib, version) \
515 __hidden_nolink1 (__GI_##name, __EI_##name, name, VERSION_##lib##_##version)
516 # define __hidden_nolink1(local, internal, name, version) \
517 __hidden_nolink2 (local, internal, name, version)
518 # define __hidden_nolink2(local, internal, name, version) \
519 extern __typeof (name) internal __attribute__ ((alias (#local))); \
520 __hidden_nolink3 (local, internal, #name "@" #version)
521 # define __hidden_nolink3(local, internal, vername) \
522 __asm__ (".symver " #internal ", " vername);
524 /* For assembly, we need to do the opposite of what we do in C:
525 in assembly gcc __REDIRECT stuff is not in place, so functions
526 are defined by its normal name and we need to create the
527 __GI_* alias to it, in C __REDIRECT causes the function definition
528 to use __GI_* name and we need to add alias to the real name.
529 There is no reason to use hidden_weak over hidden_def in assembly,
530 but we provide it for consistency with the C usage.
531 hidden_proto doesn't make sense for assembly but the equivalent
532 is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */
533 # define hidden_def(name) strong_alias (name, __GI_##name)
534 # define hidden_weak(name) hidden_def (name)
535 # define hidden_ver(local, name) strong_alias (local, __GI_##name)
536 # define hidden_data_def(name) strong_data_alias (name, __GI_##name)
537 # define hidden_data_weak(name) hidden_data_def (name)
538 # define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
539 # ifdef HAVE_ASM_GLOBAL_DOT_NAME
540 # define HIDDEN_JUMPTARGET(name) .__GI_##name
542 # define HIDDEN_JUMPTARGET(name) __GI_##name
546 # ifndef __ASSEMBLER__
547 # define hidden_proto(name, attrs...)
548 # define hidden_tls_proto(name, attrs...)
550 # define HIDDEN_JUMPTARGET(name) JUMPTARGET(name)
551 # endif /* Not __ASSEMBLER__ */
552 # define hidden_weak(name)
553 # define hidden_def(name)
554 # define hidden_ver(local, name)
555 # define hidden_data_weak(name)
556 # define hidden_data_def(name)
557 # define hidden_data_ver(local, name)
558 # define hidden_nolink(name, lib, version)
561 #if !defined NOT_IN_libc
562 # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
563 # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
564 # define libc_hidden_def(name) hidden_def (name)
565 # define libc_hidden_weak(name) hidden_weak (name)
566 # ifdef LINK_OBSOLETE_RPC
567 /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */
568 # define libc_hidden_nolink_sunrpc(name, version) hidden_def (name)
570 # define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
572 # define libc_hidden_ver(local, name) hidden_ver (local, name)
573 # define libc_hidden_data_def(name) hidden_data_def (name)
574 # define libc_hidden_data_weak(name) hidden_data_weak (name)
575 # define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
577 # define libc_hidden_proto(name, attrs...)
578 # define libc_hidden_tls_proto(name, attrs...)
579 # define libc_hidden_def(name)
580 # define libc_hidden_weak(name)
581 # define libc_hidden_ver(local, name)
582 # define libc_hidden_data_def(name)
583 # define libc_hidden_data_weak(name)
584 # define libc_hidden_data_ver(local, name)
588 # define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
589 # define rtld_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
590 # define rtld_hidden_def(name) hidden_def (name)
591 # define rtld_hidden_weak(name) hidden_weak (name)
592 # define rtld_hidden_ver(local, name) hidden_ver (local, name)
593 # define rtld_hidden_data_def(name) hidden_data_def (name)
594 # define rtld_hidden_data_weak(name) hidden_data_weak (name)
595 # define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name)
597 # define rtld_hidden_proto(name, attrs...)
598 # define rtld_hidden_tls_proto(name, attrs...)
599 # define rtld_hidden_def(name)
600 # define rtld_hidden_weak(name)
601 # define rtld_hidden_ver(local, name)
602 # define rtld_hidden_data_def(name)
603 # define rtld_hidden_data_weak(name)
604 # define rtld_hidden_data_ver(local, name)
608 # define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
609 # define libm_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
610 # define libm_hidden_def(name) hidden_def (name)
611 # define libm_hidden_weak(name) hidden_weak (name)
612 # define libm_hidden_ver(local, name) hidden_ver (local, name)
613 # define libm_hidden_data_def(name) hidden_data_def (name)
614 # define libm_hidden_data_weak(name) hidden_data_weak (name)
615 # define libm_hidden_data_ver(local, name) hidden_data_ver (local, name)
617 # define libm_hidden_proto(name, attrs...)
618 # define libm_hidden_tls_proto(name, attrs...)
619 # define libm_hidden_def(name)
620 # define libm_hidden_weak(name)
621 # define libm_hidden_ver(local, name)
622 # define libm_hidden_data_def(name)
623 # define libm_hidden_data_weak(name)
624 # define libm_hidden_data_ver(local, name)
627 #ifdef IS_IN_libresolv
628 # define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
629 # define libresolv_hidden_tls_proto(name, attrs...) \
630 hidden_tls_proto (name, ##attrs)
631 # define libresolv_hidden_def(name) hidden_def (name)
632 # define libresolv_hidden_weak(name) hidden_weak (name)
633 # define libresolv_hidden_ver(local, name) hidden_ver (local, name)
634 # define libresolv_hidden_data_def(name) hidden_data_def (name)
635 # define libresolv_hidden_data_weak(name) hidden_data_weak (name)
636 # define libresolv_hidden_data_ver(local, name) hidden_data_ver (local, name)
638 # define libresolv_hidden_proto(name, attrs...)
639 # define libresolv_hidden_tls_proto(name, attrs...)
640 # define libresolv_hidden_def(name)
641 # define libresolv_hidden_weak(name)
642 # define libresolv_hidden_ver(local, name)
643 # define libresolv_hidden_data_def(name)
644 # define libresolv_hidden_data_weak(name)
645 # define libresolv_hidden_data_ver(local, name)
649 # define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
650 # define librt_hidden_tls_proto(name, attrs...) \
651 hidden_tls_proto (name, ##attrs)
652 # define librt_hidden_def(name) hidden_def (name)
653 # define librt_hidden_weak(name) hidden_weak (name)
654 # define librt_hidden_ver(local, name) hidden_ver (local, name)
655 # define librt_hidden_data_def(name) hidden_data_def (name)
656 # define librt_hidden_data_weak(name) hidden_data_weak (name)
657 # define librt_hidden_data_ver(local, name) hidden_data_ver (local, name)
659 # define librt_hidden_proto(name, attrs...)
660 # define librt_hidden_tls_proto(name, attrs...)
661 # define librt_hidden_def(name)
662 # define librt_hidden_weak(name)
663 # define librt_hidden_ver(local, name)
664 # define librt_hidden_data_def(name)
665 # define librt_hidden_data_weak(name)
666 # define librt_hidden_data_ver(local, name)
670 # define libdl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
671 # define libdl_hidden_tls_proto(name, attrs...) \
672 hidden_tls_proto (name, ##attrs)
673 # define libdl_hidden_def(name) hidden_def (name)
674 # define libdl_hidden_weak(name) hidden_weak (name)
675 # define libdl_hidden_ver(local, name) hidden_ver (local, name)
676 # define libdl_hidden_data_def(name) hidden_data_def (name)
677 # define libdl_hidden_data_weak(name) hidden_data_weak (name)
678 # define libdl_hidden_data_ver(local, name) hidden_data_ver (local, name)
680 # define libdl_hidden_proto(name, attrs...)
681 # define libdl_hidden_tls_proto(name, attrs...)
682 # define libdl_hidden_def(name)
683 # define libdl_hidden_weak(name)
684 # define libdl_hidden_ver(local, name)
685 # define libdl_hidden_data_def(name)
686 # define libdl_hidden_data_weak(name)
687 # define libdl_hidden_data_ver(local, name)
690 #ifdef IS_IN_libnss_files
691 # define libnss_files_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
692 # define libnss_files_hidden_tls_proto(name, attrs...) \
693 hidden_tls_proto (name, ##attrs)
694 # define libnss_files_hidden_def(name) hidden_def (name)
695 # define libnss_files_hidden_weak(name) hidden_weak (name)
696 # define libnss_files_hidden_ver(local, name) hidden_ver (local, name)
697 # define libnss_files_hidden_data_def(name) hidden_data_def (name)
698 # define libnss_files_hidden_data_weak(name) hidden_data_weak (name)
699 # define libnss_files_hidden_data_ver(local, name) hidden_data_ver(local, name)
701 # define libnss_files_hidden_proto(name, attrs...)
702 # define libnss_files_hidden_tls_proto(name, attrs...)
703 # define libnss_files_hidden_def(name)
704 # define libnss_files_hidden_weak(name)
705 # define libnss_files_hidden_ver(local, name)
706 # define libnss_files_hidden_data_def(name)
707 # define libnss_files_hidden_data_weak(name)
708 # define libnss_files_hidden_data_ver(local, name)
712 # define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
713 # define libnsl_hidden_tls_proto(name, attrs...) \
714 hidden_tls_proto (name, ##attrs)
715 # define libnsl_hidden_def(name) hidden_def (name)
716 # define libnsl_hidden_weak(name) hidden_weak (name)
717 # define libnsl_hidden_ver(local, name) hidden_ver (local, name)
718 # define libnsl_hidden_data_def(name) hidden_data_def (name)
719 # define libnsl_hidden_data_weak(name) hidden_data_weak (name)
720 # define libnsl_hidden_data_ver(local, name) hidden_data_ver (local, name)
722 # define libnsl_hidden_proto(name, attrs...)
723 # define libnsl_hidden_tls_proto(name, attrs...)
724 # define libnsl_hidden_def(name)
725 # define libnsl_hidden_weak(name)
726 # define libnsl_hidden_ver(local, name)
727 # define libnsl_hidden_data_def(name)
728 # define libnsl_hidden_data_weak(name)
729 # define libnsl_hidden_data_ver(local, name)
732 #ifdef IS_IN_libnss_nisplus
733 # define libnss_nisplus_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
734 # define libnss_nisplus_hidden_tls_proto(name, attrs...) \
735 hidden_tls_proto (name, ##attrs)
736 # define libnss_nisplus_hidden_def(name) hidden_def (name)
737 # define libnss_nisplus_hidden_weak(name) hidden_weak (name)
738 # define libnss_nisplus_hidden_ver(local, name) hidden_ver (local, name)
739 # define libnss_nisplus_hidden_data_def(name) hidden_data_def (name)
740 # define libnss_nisplus_hidden_data_weak(name) hidden_data_weak (name)
741 # define libnss_nisplus_hidden_data_ver(local, name) hidden_data_ver (local, name)
743 # define libnss_nisplus_hidden_proto(name, attrs...)
744 # define libnss_nisplus_hidden_tls_proto(name, attrs...)
745 # define libnss_nisplus_hidden_def(name)
746 # define libnss_nisplus_hidden_weak(name)
747 # define libnss_nisplus_hidden_ver(local, name)
748 # define libnss_nisplus_hidden_data_def(name)
749 # define libnss_nisplus_hidden_data_weak(name)
750 # define libnss_nisplus_hidden_data_ver(local, name)
753 #define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
754 #define libc_hidden_builtin_def(name) libc_hidden_def (name)
755 #define libc_hidden_builtin_weak(name) libc_hidden_weak (name)
756 #define libc_hidden_builtin_ver(local, name) libc_hidden_ver (local, name)
758 # define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
762 # define libutil_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
763 # define libutil_hidden_tls_proto(name, attrs...) \
764 hidden_tls_proto (name, ##attrs)
765 # define libutil_hidden_def(name) hidden_def (name)
766 # define libutil_hidden_weak(name) hidden_weak (name)
767 # define libutil_hidden_ver(local, name) hidden_ver (local, name)
768 # define libutil_hidden_data_def(name) hidden_data_def (name)
769 # define libutil_hidden_data_weak(name) hidden_data_weak (name)
770 # define libutil_hidden_data_ver(local, name) hidden_data_ver (local, name)
772 # define libutil_hidden_proto(name, attrs...)
773 # define libutil_hidden_tls_proto(name, attrs...)
774 # define libutil_hidden_def(name)
775 # define libutil_hidden_weak(name)
776 # define libutil_hidden_ver(local, name)
777 # define libutil_hidden_data_def(name)
778 # define libutil_hidden_data_weak(name)
779 # define libutil_hidden_data_ver(local, name)
782 /* Get some dirty hacks. */
783 #include <symbol-hacks.h>
785 /* Move compatibility symbols out of the way by placing them all in a
787 #ifndef __ASSEMBLER__
788 # define attribute_compat_text_section \
789 __attribute__ ((section (".text.compat")))
790 # define attribute_compat_data_section \
791 __attribute__ ((section (".data.compat")))
793 # define compat_text_section .section ".text.compat", "ax";
794 # define compat_data_section .section ".data.compat", "aw";
797 /* Marker used for indirection function symbols. */
798 #define libc_ifunc(name, expr) \
799 extern void *name##_ifunc (void) __asm__ (#name); \
800 void *name##_ifunc (void) \
803 __typeof (name) *res = expr; \
806 __asm__ (".type " #name ", %gnu_indirect_function");
808 /* The body of the function is supposed to use __get_cpu_features
809 which will, if necessary, initialize the data first. */
810 #define libm_ifunc(name, expr) \
811 extern void *name##_ifunc (void) __asm__ (#name); \
812 void *name##_ifunc (void) \
814 __typeof (name) *res = expr; \
817 __asm__ (".type " #name ", %gnu_indirect_function");
819 #ifdef HAVE_ASM_SET_DIRECTIVE
820 # define libc_ifunc_hidden_def1(local, name) \
821 __asm__ (".globl " #local "\n\t" \
822 ".hidden " #local "\n\t" \
823 ".set " #local ", " #name);
825 # define libc_ifunc_hidden_def1(local, name) \
826 __asm__ (".globl " #local "\n\t" \
827 ".hidden " #local "\n\t" \
831 #define libc_ifunc_hidden_def(name) \
832 libc_ifunc_hidden_def1 (__GI_##name, name)
834 /* Add the compiler optimization to inhibit loop transformation to library
835 calls. This is used to avoid recursive calls in memset and memmove
836 default implementations. */
837 #ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
838 # define inhibit_loop_to_libcall \
839 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
841 # define inhibit_loop_to_libcall
844 #endif /* libc-symbols.h */