summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-18 00:15:25 +0000
committerRoland McGrath <roland@gnu.org>2002-09-18 00:15:25 +0000
commitc843e065a1658d1a6d55a0f0b3befd200c3ec595 (patch)
tree41166e6a9bf5389eef8c7ed03eec912a808d51c6 /include
parentc435d57c38920365341ff95afb8128ecf0201ce4 (diff)
downloadglibc-c843e065a1658d1a6d55a0f0b3befd200c3ec595.tar.gz
* malloc/Makefile ($(objpfx)memusagestat.o: sysincludes): Define
file-specific variable override so it compiles properly when using --with-headers. * NEWS: Added item for powerpc64-linux port. * include/libc-symbols.h [HAVE_ASM_GLOBAL_DOT_NAME] (C_SYMBOL_DOT_NAME): Insure that C_SYMBOL_DOT_NAME works for various gcc versions. Dot names required for powerpc64. [HAVE_ASM_GLOBAL_DOT_NAME] (_weak_extern): Add .weakext '.'ed symbol. [HAVE_ASM_GLOBAL_DOT_NAME] (strong_alias): Add .global C_SYMBOL_DOT_NAME(alias). [HAVE_ASM_GLOBAL_DOT_NAME] (strong_data_alias): New macro. Same as original strong_alias macro. [HAVE_ASM_GLOBAL_DOT_NAME] (weak_alias): Add .weakext/.weak C_SYMBOL_DOT_NAME(alias). [HAVE_ASM_GLOBAL_DOT_NAME] (_symbol_version): Add .symver '.'ed name. [HAVE_ASM_GLOBAL_DOT_NAME] (_default_symbol_version): Add .symver '.'ed name. Add comments on libc_hidden_data_def and libc_hidden_data_weak usage. [HAVE_ASM_GLOBAL_DOT_NAME] (hidden_dot_def1): New macro. Generate .global C_SYMBOL_DOT_NAME(alias). Otherwise an empty macro. (hidden_def): Append hidden_dot_def1 macro to definition. (hidden_ver): Append hidden_dot_def1 macro to definition. (hidden_data_def): New macro. Same as original hidden_def macro. (hidden_data_ver): New macro. Same as original hidden_ver macro. [HAVE_ASM_GLOBAL_DOT_NAME] (hidden_dot_weak1): New macro. Generate .weakext C_SYMBOL_DOT_NAME(alias). Otherwise an empty macro. (hidden_weak): Append hidden_dot_weak1 macro to definition. (hidden_data_weak): New macro. Same as original hidden_weak macro. [HAVE_ASM_GLOBAL_DOT_NAME] (HIDDEN_JUMPTARGET): Define as .__GI_name. Otherwise defined as __GI_name. (libc_hidden_data_def): New macro. Use hidden_data_def. (libc_hidden_data_weak): New macro. Use hidden_data_weak. (libc_hidden_data_ver): New macro. Use hidden_data_ver. (rtld_hidden_data_def): New macro. Use hidden_data_def. (rtld_hidden_data_weak): New macro. Use hidden_data_weak. (rtld_hidden_data_ver): New macro. Use hidden_data_ver. (libm_hidden_data_def): New macro. Use hidden_data_def. (libm_hidden_data_weak): New macro. Use hidden_data_weak. (libm_hidden_data_ver): New macro. Use hidden_data_ver. * inet/in6_addr.c: Replace libc_hidden_def with libc_hidden_data_def.
Diffstat (limited to 'include')
-rw-r--r--include/libc-symbols.h198
1 files changed, 160 insertions, 38 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 0c219514b1..d322147f97 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -82,8 +82,15 @@
# define ASM_LINE_SEP ;
#endif
-#ifndef C_SYMBOL_DOT_NAME
-# define C_SYMBOL_DOT_NAME(name) .##name
+#ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# ifndef C_SYMBOL_DOT_NAME
+# if defined __GNUC__ && defined __GNUC_MINOR__ \
+ && (__GNUC__ << 16) + __GNUC_MINOR__ >= (3 << 16) + 1
+# define C_SYMBOL_DOT_NAME(name) .name
+# else
+# define C_SYMBOL_DOT_NAME(name) .##name
+# endif
+# endif
#endif
#ifndef __ASSEMBLER__
@@ -111,9 +118,21 @@
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
# define weak_extern(symbol) _weak_extern (symbol)
# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
-# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define _weak_extern(symbol) \
+ asm (".weakext " __SYMBOL_PREFIX #symbol "\n\t" \
+ ".weakext ." __SYMBOL_PREFIX #symbol);
+# else
+# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
+# endif
# else
-# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define _weak_extern(symbol) \
+ asm (".weak " __SYMBOL_PREFIX #symbol "\n\t" \
+ ".weak ." __SYMBOL_PREFIX #symbol);
+# else
+# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
+# endif
# endif
# else
@@ -126,45 +145,67 @@
#else /* __ASSEMBLER__ */
# ifdef HAVE_ASM_SET_DIRECTIVE
-# define strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define strong_alias(original, alias) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
+ .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original) ASM_LINE_SEP \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
+ .set C_SYMBOL_DOT_NAME (alias),C_SYMBOL_DOT_NAME (original)
+# define strong_data_alias(original, alias) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
.set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
+# else
+# define strong_alias(original, alias) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
+ .set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
+# define strong_data_alias(original, alias) strong_alias(original, alias)
+# endif
# else
# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
+# define strong_alias(original, alias) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
+ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
+# define strong_data_alias(original, alias) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
+ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
# else
-# define strong_alias(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
+# define strong_alias(original, alias) \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
+# define strong_data_alias(original, alias) strong_alias(original, alias)
# endif
# endif
# ifdef HAVE_WEAK_SYMBOLS
# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
-# define weak_alias(original, alias) \
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define weak_alias(original, alias) \
+ .weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original) ASM_LINE_SEP \
+ .weakext C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
+# else
+# define weak_alias(original, alias) \
.weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
-# define weak_extern(symbol) \
+# endif
+# define weak_extern(symbol) \
.weakext C_SYMBOL_NAME (symbol)
# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define weak_alias(original, alias) \
- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
+# define weak_alias(original, alias) \
+ .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
+ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
+ .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
# else
-# define weak_alias(original, alias) \
- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
+# define weak_alias(original, alias) \
+ .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
# endif
-# define weak_extern(symbol) \
+# define weak_extern(symbol) \
.weak C_SYMBOL_NAME (symbol)
# endif /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
@@ -364,15 +405,33 @@
# define default_symbol_version(real, name, version) \
_default_symbol_version(real, name, version)
# ifdef __ASSEMBLER__
-# define _symbol_version(real, name, version) \
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define _symbol_version(real, name, version) \
+ .symver real, name##@##version ASM_LINE_SEP \
+ .symver .##real, .##name##@##version
+# define _default_symbol_version(real, name, version) \
+ .symver real, name##@##@##version ASM_LINE_SEP \
+ .symver .##real, .##name##@##@##version
+# else
+# define _symbol_version(real, name, version) \
.symver real, name##@##version
-# define _default_symbol_version(real, name, version) \
+# define _default_symbol_version(real, name, version) \
.symver real, name##@##@##version
+# endif
# else
-# define _symbol_version(real, name, version) \
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define _symbol_version(real, name, version) \
+ __asm__ (".symver " #real "," #name "@" #version "\n\t" \
+ ".symver ." #real ",." #name "@" #version)
+# define _default_symbol_version(real, name, version) \
+ __asm__ (".symver " #real "," #name "@@" #version "\n\t" \
+ ".symver ." #real ",." #name "@@" #version)
+# else
+# define _symbol_version(real, name, version) \
__asm__ (".symver " #real "," #name "@" #version)
-# define _default_symbol_version(real, name, version) \
+# define _default_symbol_version(real, name, version) \
__asm__ (".symver " #real "," #name "@@" #version)
+# endif
# endif
#else
# define symbol_version(real, name, version)
@@ -439,6 +498,21 @@
}
libc_hidden_weak (foo)
+ Simularly for global data. If references to foo within libc.so should
+ always go to foo defined in libc.so, then in include/foo.h you add:
+
+ libc_hidden_proto (foo)
+
+ line and after foo's definition:
+
+ int foo = INITIAL_FOO_VALUE;
+ libc_hidden_data_def (foo)
+
+ or
+
+ int foo = INITIAL_FOO_VALUE;
+ libc_hidden_data_weak (foo)
+
If foo is normally just an alias (strong or weak) of some other function,
you should use the normal strong_alias first, then add libc_hidden_def
or libc_hidden_weak:
@@ -494,43 +568,63 @@
# define __hidden_def1(original, alias) \
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
.set C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
-# else
# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define __hidden_def1(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
+# define __hidden_dot_def1(original, alias) ASM_LINE_SEP \
ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
+ .set C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
# else
-# define __hidden_def1(original, alias) \
+# define __hidden_dot_def1(original, alias)
+# endif
+# else
+# define __hidden_def1(original, alias) \
ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define __hidden_dot_def1(original, alias) ASM_LINE_SEP \
+ ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
+ C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
+# else
+# define __hidden_def1(original, alias)
# endif
# endif
# define __hidden_def2(...) #__VA_ARGS__
# define __hidden_def3(...) __hidden_def2 (__VA_ARGS__)
# define hidden_def(name) \
+ __asm__ (__hidden_def3 (__hidden_def1 (__GI_##name, name) \
+ __hidden_dot_def1 (__GI_##name, name)));
+# define hidden_data_def(name) \
__asm__ (__hidden_def3 (__hidden_def1 (__GI_##name, name)));
# define hidden_ver(local, name) \
+ __asm__ (__hidden_def3 (__hidden_def1 (local, __GI_##name) \
+ __hidden_dot_def1 (local, __GI_##name)));
+# define hidden_data_ver(local, name) \
__asm__ (__hidden_def3 (__hidden_def1 (local, __GI_##name)));
# ifdef HAVE_WEAK_SYMBOLS
# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
# define __hidden_weak1(original, alias) \
.weakext C_SYMBOL_NAME (alias), C_SYMBOL_NAME (original)
-# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define __hidden_weak1(original, alias) \
+# define __hidden_dot_weak1(original, alias) ASM_LINE_SEP \
+ .weakext C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
+# else
+# define __hidden_dot_weak1(original, alias)
+# endif
+# else /* ! HAVE_ASM_WEAKEXT_DIRECTIVE */
+# define __hidden_weak1(original, alias) \
.weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
+ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define __hidden_dot_weak1(original, alias) ASM_LINE_SEP \
ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
# else
-# define __hidden_weak1(original, alias) \
- .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
+# define __hidden_dot_weak1(original, alias)
# endif
# endif
# define hidden_weak(name) \
+ __asm__ (__hidden_def3 (__hidden_weak1 (__GI_##name, name) \
+ __hidden_dot_weak1 (__GI_##name, name)));
+# define hidden_data_weak(name) \
__asm__ (__hidden_def3 (__hidden_weak1 (__GI_##name, name)));
# else
# define hidden_weak(name) hidden_def (name)
@@ -548,7 +642,14 @@
# define hidden_def(name) strong_alias (name, __GI_##name)
# define hidden_weak(name) hidden_def (name)
# define hidden_ver(local, name) strong_alias (local, __GI_##name)
-# define HIDDEN_JUMPTARGET(name) __GI_##name
+# define hidden_data_def(name) strong_data_alias (name, __GI_##name)
+# define hidden_data_weak(name) hidden_data_def (name)
+# define hidden_data_ver(local, name) strong_data_alias (local, __GI_##name)
+# ifdef HAVE_ASM_GLOBAL_DOT_NAME
+# define HIDDEN_JUMPTARGET(name) .__GI_##name
+# else
+# define HIDDEN_JUMPTARGET(name) __GI_##name
+# endif
# endif
#else
# ifndef __ASSEMBLER__
@@ -559,6 +660,9 @@
# define hidden_weak(name)
# define hidden_def(name)
# define hidden_ver(local, name)
+# define hidden_data_weak(name)
+# define hidden_data_def(name)
+# define hidden_data_ver(local, name)
#endif
#if !defined NOT_IN_libc
@@ -566,11 +670,17 @@
# define libc_hidden_def(name) hidden_def (name)
# define libc_hidden_weak(name) hidden_weak (name)
# define libc_hidden_ver(local, name) hidden_ver (local, name)
+# define libc_hidden_data_def(name) hidden_data_def (name)
+# define libc_hidden_data_weak(name) hidden_data_weak (name)
+# define libc_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
# define libc_hidden_proto(name, attrs...)
# define libc_hidden_def(name)
# define libc_hidden_weak(name)
# define libc_hidden_ver(local, name)
+# define libc_hidden_data_def(name)
+# define libc_hidden_data_weak(name)
+# define libc_hidden_data_ver(local, name)
#endif
#if defined NOT_IN_libc && defined IS_IN_rtld
@@ -578,11 +688,17 @@
# define rtld_hidden_def(name) hidden_def (name)
# define rtld_hidden_weak(name) hidden_weak (name)
# define rtld_hidden_ver(local, name) hidden_ver (local, name)
+# define rtld_hidden_data_def(name) hidden_data_def (name)
+# define rtld_hidden_data_weak(name) hidden_data_weak (name)
+# define rtld_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
# define rtld_hidden_proto(name, attrs...)
# define rtld_hidden_def(name)
# define rtld_hidden_weak(name)
# define rtld_hidden_ver(local, name)
+# define rtld_hidden_data_def(name)
+# define rtld_hidden_data_weak(name)
+# define rtld_hidden_data_ver(local, name)
#endif
#if defined NOT_IN_libc && defined IS_IN_libm
@@ -590,11 +706,17 @@
# define libm_hidden_def(name) hidden_def (name)
# define libm_hidden_weak(name) hidden_weak (name)
# define libm_hidden_ver(local, name) hidden_ver (local, name)
+# define libm_hidden_data_def(name) hidden_data_def (name)
+# define libm_hidden_data_weak(name) hidden_data_weak (name)
+# define libm_hidden_data_ver(local, name) hidden_data_ver (local, name)
#else
# define libm_hidden_proto(name, attrs...)
# define libm_hidden_def(name)
# define libm_hidden_weak(name)
# define libm_hidden_ver(local, name)
+# define libm_hidden_data_def(name)
+# define libm_hidden_data_weak(name)
+# define libm_hidden_data_ver(local, name)
#endif
#endif /* libc-symbols.h */