1.1 --- a/patches/glibc/2.2.5/glibc-2.2.5-allow-gcc-3.4-weakextern.patch Tue Aug 14 19:32:22 2007 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,48 +0,0 @@
1.4 -Suggested by Jake Page <jake at cs dot stanford dot edu>
1.5 -in http://sources.redhat.com/ml/crossgcc/2004-07/msg00169.html
1.6 -but the libc-symbols.h fragment has been reworked to fix typos
1.7 -and to still work on gcc-2.95.3, which lacks _Pragma.
1.8 -
1.9 -His comment was:
1.10 - Fixes gcc-3.4 optimizing out comparisons to weak external symbols in code
1.11 - like:
1.12 - if (__pthread_mutex_init != NULL)
1.13 - __pthread_mutex_init(...);
1.14 - that causes segfaults during libc init when not linked to libpthread
1.15 -
1.16 -diff -uNr glibc-2.2.5-orig/resolv/res_libc.c glibc-2.2.5/resolv/res_libc.c
1.17 ---- glibc-2.2.5-orig/resolv/res_libc.c 2001-02-12 12:23:34.000000000 -0800
1.18 -+++ glibc-2.2.5/resolv/res_libc.c 2004-07-27 22:56:32.000000000 -0700
1.19 -@@ -84,7 +84,8 @@
1.20 -
1.21 - #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2)
1.22 - # undef res_init
1.23 --strong_alias (__res_init, __res_init_weak);
1.24 -+extern int __res_init_weak (void);
1.25 - weak_extern (__res_init_weak);
1.26 -+strong_alias (__res_init, __res_init_weak);
1.27 - compat_symbol (libc, __res_init_weak, res_init, GLIBC_2_0);
1.28 - #endif
1.29 ---- glibc-2.2.5/include/libc-symbols.h.old Fri Aug 13 04:20:55 2004
1.30 -+++ glibc-2.2.5/include/libc-symbols.h Fri Aug 13 04:37:06 2004
1.31 -@@ -108,10 +108,16 @@
1.32 -
1.33 - /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
1.34 - # define weak_extern(symbol) _weak_extern (symbol)
1.35 --# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
1.36 --# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
1.37 --# else
1.38 --# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
1.39 -+# if __GNUC__ >= 3
1.40 -+ /* see http://sources.redhat.com/ml/libc-alpha/2003-01/msg00043.html */
1.41 -+# define __weak_extern_1(expr) _Pragma(#expr)
1.42 -+# define _weak_extern(symbol) __weak_extern_1(weak symbol)
1.43 -+# else /* __GNUC__ == 2 */
1.44 -+# ifdef HAVE_ASM_WEAKEXT_DIRECTIVE
1.45 -+# define _weak_extern(symbol) asm (".weakext " __SYMBOL_PREFIX #symbol);
1.46 -+# else
1.47 -+# define _weak_extern(symbol) asm (".weak " __SYMBOL_PREFIX #symbol);
1.48 -+# endif
1.49 - # endif
1.50 -
1.51 - # else