]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fix thread local storage support in GCC older than 4.9.
authorMaria Matejka <mq@ucw.cz>
Wed, 22 Apr 2020 15:14:26 +0000 (17:14 +0200)
committerMaria Matejka <mq@ucw.cz>
Thu, 30 Apr 2020 15:38:30 +0000 (17:38 +0200)
Let's hope this will be history soon.

aclocal.m4
configure.ac
filter/filter.c
proto/bgp/attrs.c

index 1613d6803007d4cb9474672b2181be40294e3339..00453e5fdc312e728c7e415b1fbb1483895de9e3 100644 (file)
@@ -15,8 +15,17 @@ AC_DEFUN([BIRD_CHECK_THREAD_LOCAL],
       )
     ],
     [bird_cv_thread_local=yes],
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM(
+       [
+         static __thread int x = 42;
+       ],
+       []
+      )
+    ],
+    [bird_cv_thread_local=__thread],
     [bird_cv_thread_local=no]
-    )
+    ))
   )
 ])
 
index 7ef31fb449417e2ca122af87aee133fa1398cc86..31db7bd16c1cbed4e8e5c3bf846a3c62ae7c60e7 100644 (file)
@@ -120,7 +120,9 @@ fi
 
 BIRD_CHECK_THREAD_LOCAL
 if test "$bird_cv_thread_local" = no ; then
-  AC_MSG_ERROR([Thread-local storage not available]) 
+  AC_MSG_ERROR([Thread-local storage not available])
+elif test "$bird_cv_thread_local" != yes ; then
+  CFLAGS="$CFLAGS -D_Thread_local=$bird_cv_thread_local"
 fi
 
 BIRD_CHECK_PTHREADS
index ca2bfc14edce5bda2883024b425538d9e76c6cad..ec727740984c38d17c053aae7850cd3bde75610f 100644 (file)
@@ -91,8 +91,8 @@ struct filter_state {
   struct buffer buf;
 };
 
-_Thread_local static struct filter_state filter_state;
-_Thread_local static struct filter_stack filter_stack;
+static _Thread_local struct filter_state filter_state;
+static _Thread_local struct filter_stack filter_stack;
 
 void (*bt_assert_hook)(int result, const struct f_line_item *assert);
 
index 439de507e292285e82a5c257b7257b9a8ad82cff..a7aa28053bc0cee5d5817e0bdc61a1f1dbefa7e6 100644 (file)
@@ -2248,7 +2248,7 @@ bgp_rte_modify_stale(struct rte_storage *r, struct linpool *pool)
   if (ad && int_set_contains(ad, BGP_COMM_LLGR_STALE))
     return r->attrs;
 
-  _Thread_local static struct {
+  static _Thread_local struct {
     rta a;
     u32 labels[MPLS_MAX_LABEL_STACK];
   } aloc;