Workaround for http://gcc.gnu.org/PR25240
authorjakub <jakub>
Tue, 20 Dec 2005 10:55:59 +0000 (10:55 +0000)
committerjakub <jakub>
Tue, 20 Dec 2005 10:55:59 +0000 (10:55 +0000)
* include/libc-symbols.h (weak_extern): Define using weak attribute.
(_weak_extern): Remove.
(weak_tls_extern): Define.
* locale/uselocale.c (DEFINE_CATEGORY): Use weak_tls_extern for
_nl_current_##category.
* locale/setlocale.c (DEFINE_CATEGORY): Likewise.

ChangeLog
include/libc-symbols.h
locale/setlocale.c
locale/uselocale.c

index d409260..490da6a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-12-20  Jakub Jelinek  <jakub@redhat.com>
+
+       Workaround for http://gcc.gnu.org/PR25240
+       * include/libc-symbols.h (weak_extern): Define using weak attribute.
+       (_weak_extern): Remove.
+       (weak_tls_extern): Define.
+       * locale/uselocale.c (DEFINE_CATEGORY): Use weak_tls_extern for
+       _nl_current_##category.
+       * locale/setlocale.c (DEFINE_CATEGORY): Likewise.
+
 2005-12-19  Ulrich Drepper  <drepper@redhat.com>
 
        [BZ #1955]
index 8ee9407..f69bf83 100644 (file)
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
 
 /* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined).  */
-#  define weak_extern(symbol) _weak_extern (weak symbol)
-#  define _weak_extern(expr) _Pragma (#expr)
+#  define weak_extern(symbol) extern __typeof (symbol) symbol __attribute__ ((weak));
+#  define weak_tls_extern(symbol) extern __thread __typeof (symbol) symbol __attribute__ ((weak));
 
 # else
 
index 50bf8e7..dc65d93 100644 (file)
@@ -39,7 +39,7 @@
 # define DEFINE_CATEGORY(category, category_name, items, a) \
     extern char _nl_current_##category##_used; \
     weak_extern (_nl_current_##category##_used) \
-    weak_extern (_nl_current_##category)
+    weak_tls_extern (_nl_current_##category)
 # include "categories.def"
 # undef        DEFINE_CATEGORY
 
index 4e63dab..671c519 100644 (file)
@@ -54,7 +54,7 @@ __uselocale (locale_t newloc)
       {                                                                              \
        extern char _nl_current_##category##_used;                            \
        weak_extern (_nl_current_##category##_used)                           \
-       weak_extern (_nl_current_##category)                                  \
+       weak_tls_extern (_nl_current_##category)                                      \
        if (&_nl_current_##category##_used != 0)                              \
          _nl_current_##category = &locobj->__locales[category];              \
       }