alias symbol changes for gcc4
Richard Henderson
rth@redhat.com
Wed Mar 16 16:12:00 GMT 2005
The following patch fixes up the symbol alias macros such that we don't
do anything by __asm__ directly, but rather always use the alias attribute.
Which lets the compiler keep track of which symbols are actually used,
which means that you won't get symbols deleted on you.
The wcscoll changes resolve a bit of confusion in that file wrt who
defines what symbol. Fortunately, __wcscoll isn't actually used anymore,
since we changed wcscoll to use the libc_hidden stuff, that's what we use
in the regexp routines directly.
Tested on i686-linux with gcc 3.4 and gcc 4.0 (plus a pending patch).
r~
2005-03-16 Richard Henderson <rth@redhat.com>
* include/libc-symbols.h (__hidden_proto): Remove bogus declaration
of internal.
(__hidden_def1, __hidden_dot_def1): Remove.
(__hidden_def2, __hidden_def3): Remove.
(__hidden_ver1): New.
(hidden_ver, hidden_def, hidden_weak): Use it.
(hidden_data_ver, hidden_data_ver, hidden_data_weak): Use non-data
version of the macro.
* include/wchar.h (__wcscoll): Remove.
* wcsmbs/wcscoll.c: Define wcscoll directly instead of via __wcscoll.
* string/strcoll.c: Don't issue libc_hidden_def STRCOLL redefined.
Index: include/libc-symbols.h
===================================================================
RCS file: /cvs/glibc/libc/include/libc-symbols.h,v
retrieving revision 1.70
diff -u -p -d -r1.70 libc-symbols.h
--- include/libc-symbols.h 11 Feb 2005 00:29:46 -0000 1.70
+++ include/libc-symbols.h 16 Mar 2005 16:02:55 -0000
@@ -583,78 +583,23 @@ for linking")
# define hidden_proto(name, attrs...) \
__hidden_proto (name, __GI_##name, ##attrs)
# define __hidden_proto(name, internal, attrs...) \
- extern __typeof (name) internal; \
extern __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
__hidden_proto_hiddenattr (attrs);
# define __hidden_asmname(name) \
__hidden_asmname1 (__USER_LABEL_PREFIX__, name)
# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
# define __hidden_asmname2(prefix, name) #prefix name
-# ifdef HAVE_ASM_SET_DIRECTIVE
-# define __hidden_def1(original, alias) \
- ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (alias) ASM_LINE_SEP \
- .set 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 \
- .set C_SYMBOL_DOT_NAME (alias), C_SYMBOL_DOT_NAME (original)
-# else
-# 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_dot_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)
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# 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)
-# ifdef HAVE_ASM_GLOBAL_DOT_NAME
-# define __hidden_dot_weak1(original, alias) ASM_LINE_SEP \
- .weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
- C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
-# else
-# 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)
-# endif
+# define __hidden_ver1(local, internal, name) \
+ extern __typeof (name) __EI_##name __asm__(__hidden_asmname (#internal)); \
+ extern __typeof (name) __EI_##name \
+ __attribute__((alias (__hidden_asmname (#local))))
+# define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
+# define hidden_data_ver(local, name) hidden_ver(local, name)
+# define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
+# define hidden_data_def(name) hidden_def(name)
+# define hidden_weak(name) \
+ __hidden_ver1(__GI_##name, name, name) __attribute__((weak));
+# define hidden_data_weak(name) hidden_weak(name)
# else
/* For assembly, we need to do the opposite of what we do in C:
in assembly gcc __REDIRECT stuff is not in place, so functions
Index: include/wchar.h
===================================================================
RCS file: /cvs/glibc/libc/include/wchar.h,v
retrieving revision 1.26
diff -u -p -d -r1.26 wchar.h
--- include/wchar.h 14 Mar 2004 20:45:10 -0000 1.26
+++ include/wchar.h 16 Mar 2005 16:02:55 -0000
@@ -56,7 +56,6 @@ extern int __wcscasecmp (__const wchar_t
extern int __wcsncasecmp (__const wchar_t *__s1, __const wchar_t *__s2,
size_t __n)
__attribute_pure__;
-extern int __wcscoll (__const wchar_t *__s1, __const wchar_t *__s2);
extern size_t __wcslen (__const wchar_t *__s) __attribute_pure__;
extern size_t __wcsnlen (__const wchar_t *__s, size_t __maxlen)
__attribute_pure__;
Index: string/strcoll.c
===================================================================
RCS file: /cvs/glibc/libc/string/strcoll.c,v
retrieving revision 1.33
diff -u -p -d -r1.33 strcoll.c
--- string/strcoll.c 14 Mar 2004 20:51:30 -0000 1.33
+++ string/strcoll.c 16 Mar 2005 16:02:55 -0000
@@ -23,6 +23,7 @@
# define STRING_TYPE char
# define STRCOLL strcoll
# define STRCOLL_L __strcoll_l
+# define USE_HIDDEN_DEF
#endif
#include "../locale/localeinfo.h"
@@ -35,6 +36,7 @@ STRCOLL (s1, s2)
{
return STRCOLL_L (s1, s2, _NL_CURRENT_LOCALE);
}
-#if !defined WIDE_CHAR_VERSION
-libc_hidden_def (strcoll)
+
+#ifdef USE_HIDDEN_DEF
+libc_hidden_def (STRCOLL)
#endif
Index: wcsmbs/wcscoll.c
===================================================================
RCS file: /cvs/glibc/libc/wcsmbs/wcscoll.c,v
retrieving revision 1.13
diff -u -p -d -r1.13 wcscoll.c
--- wcsmbs/wcscoll.c 14 Mar 2004 21:05:48 -0000 1.13
+++ wcsmbs/wcscoll.c 16 Mar 2005 16:02:55 -0000
@@ -22,12 +22,11 @@
#define STRING_TYPE wchar_t
#define USTRING_TYPE wint_t
-#define STRCOLL __wcscoll
+#define STRCOLL wcscoll
#define STRCOLL_L __wcscoll_l
#include "../string/strcoll.c"
#ifndef USE_IN_EXTENDED_LOCALE_MODEL
-weak_alias (__wcscoll, wcscoll)
libc_hidden_weak (wcscoll)
#endif
More information about the Libc-alpha
mailing list