1feee8
commit bbe4bbb6e8997b5ff9843bd3f32ac77dbaec7284
1feee8
Author: Fangrui Song <maskray@google.com>
1feee8
Date:   Mon Aug 16 09:59:30 2021 -0700
1feee8
1feee8
    elf: Drop elf/tls-macros.h in favor of __thread and tls_model attributes [BZ #28152] [BZ #28205]
1feee8
    
1feee8
    elf/tls-macros.h was added for TLS testing when GCC did not support
1feee8
    __thread. __thread and tls_model attributes are mature now and have been
1feee8
    used by many newer tests.
1feee8
    
1feee8
    Also delete tst-tls2.c which tests .tls_common (unused by modern GCC and
1feee8
    unsupported by Clang/LLD). .tls_common and .tbss definition are almost
1feee8
    identical after linking, so the runtime test doesn't add additional
1feee8
    coverage.  Assembler and linker tests should be on the binutils side.
1feee8
    
1feee8
    When LLD 13.0.0 is allowed in configure.ac
1feee8
    (https://sourceware.org/pipermail/libc-alpha/2021-August/129866.html),
1feee8
    `make check` result is on par with glibc built with GNU ld on aarch64
1feee8
    and x86_64.
1feee8
    
1feee8
    As a future clean-up, TLS_GD/TLS_LD/TLS_IE/TLS_IE macros can be removed from
1feee8
    sysdeps/*/tls-macros.h. We can add optional -mtls-dialect={gnu2,trad}
1feee8
    tests to ensure coverage.
1feee8
    
1feee8
    Tested on aarch64-linux-gnu, powerpc64le-linux-gnu, and x86_64-linux-gnu.
1feee8
    
1feee8
    Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
1feee8
    (cherry picked from commit 33c50ef42878b07ee6ead8b3f1a81d8c2c74697c)
1feee8
1feee8
Conflicts:
1feee8
	elf/Makefile
1feee8
	  (different backport order)
1feee8
1feee8
diff --git a/elf/Makefile b/elf/Makefile
1feee8
index feec365e4e5fe9b3..3a8590e0d3cc33ab 100644
1feee8
--- a/elf/Makefile
1feee8
+++ b/elf/Makefile
1feee8
@@ -275,7 +275,6 @@ tests-static-internal := \
1feee8
   tst-ptrguard1-static \
1feee8
   tst-stackguard1-static \
1feee8
   tst-tls1-static \
1feee8
-  tst-tls2-static \
1feee8
   tst-tls1-static-non-pie \
1feee8
   # tests-static-internal
1feee8
 
1feee8
@@ -308,7 +307,6 @@ tests := \
1feee8
 tests-internal := \
1feee8
   $(tests-static-internal) \
1feee8
   tst-tls1 \
1feee8
-  tst-tls2 \
1feee8
   # tests-internal
1feee8
 
1feee8
 tests-static := $(tests-static-normal) $(tests-static-internal)
1feee8
diff --git a/elf/tls-macros.h b/elf/tls-macros.h
1feee8
deleted file mode 100644
1feee8
index e25e33b0f032099d..0000000000000000
1feee8
--- a/elf/tls-macros.h
1feee8
+++ /dev/null
1feee8
@@ -1,25 +0,0 @@
1feee8
-/* Macros to support TLS testing in times of missing compiler support.  */
1feee8
-
1feee8
-#define COMMON_INT_DEF(x) \
1feee8
-  asm (".tls_common " #x ",4,4")
1feee8
-/* XXX Until we get compiler support we don't need declarations.  */
1feee8
-#define COMMON_INT_DECL(x)
1feee8
-
1feee8
-/* XXX This definition will probably be machine specific, too.  */
1feee8
-#define VAR_INT_DEF(x) \
1feee8
-  asm (".section .tdata\n\t"						      \
1feee8
-       ".globl " #x "\n"						      \
1feee8
-       ".balign 4\n"							      \
1feee8
-       #x ":\t.long 0\n\t"						      \
1feee8
-       ".size " #x ",4\n\t"						      \
1feee8
-       ".previous")
1feee8
-/* XXX Until we get compiler support we don't need declarations.  */
1feee8
-#define VAR_INT_DECL(x)
1feee8
-
1feee8
-#include_next <tls-macros.h>
1feee8
-
1feee8
-  /* XXX Each architecture must have its own asm for now.  */
1feee8
-#if !defined TLS_LE || !defined TLS_IE \
1feee8
-      || !defined TLS_LD || !defined TLS_GD
1feee8
-# error "No support for this architecture so far."
1feee8
-#endif
1feee8
diff --git a/elf/tst-tls1.c b/elf/tst-tls1.c
1feee8
index c31da56ce9cb3e8f..b3412213ee9eaa7e 100644
1feee8
--- a/elf/tst-tls1.c
1feee8
+++ b/elf/tst-tls1.c
1feee8
@@ -1,13 +1,14 @@
1feee8
 /* glibc test for TLS in ld.so.  */
1feee8
 #include <stdio.h>
1feee8
 
1feee8
-#include "tls-macros.h"
1feee8
-
1feee8
-
1feee8
-/* Two common 'int' variables in TLS.  */
1feee8
-COMMON_INT_DEF(foo);
1feee8
-COMMON_INT_DEF(bar);
1feee8
 
1feee8
+__thread int foo, bar __attribute__ ((tls_model("local-exec")));
1feee8
+extern __thread int foo_gd asm ("foo") __attribute__ ((tls_model("global-dynamic")));
1feee8
+extern __thread int foo_ld asm ("foo") __attribute__ ((tls_model("local-dynamic")));
1feee8
+extern __thread int foo_ie asm ("foo") __attribute__ ((tls_model("initial-exec")));
1feee8
+extern __thread int bar_gd asm ("bar") __attribute__ ((tls_model("global-dynamic")));
1feee8
+extern __thread int bar_ld asm ("bar") __attribute__ ((tls_model("local-dynamic")));
1feee8
+extern __thread int bar_ie asm ("bar") __attribute__ ((tls_model("initial-exec")));
1feee8
 
1feee8
 static int
1feee8
 do_test (void)
1feee8
@@ -18,63 +19,48 @@ do_test (void)
1feee8
 
1feee8
   /* Set the variable using the local exec model.  */
1feee8
   puts ("set bar to 1 (LE)");
1feee8
-  ap = TLS_LE (bar);
1feee8
-  *ap = 1;
1feee8
+  bar = 1;
1feee8
 
1feee8
 
1feee8
   /* Get variables using initial exec model.  */
1feee8
   fputs ("get sum of foo and bar (IE)", stdout);
1feee8
-  ap = TLS_IE (foo);
1feee8
-  bp = TLS_IE (bar);
1feee8
+  ap = &foo_ie;
1feee8
+  bp = &bar_ie;
1feee8
   printf (" = %d\n", *ap + *bp);
1feee8
   result |= *ap + *bp != 1;
1feee8
-  if (*ap != 0)
1feee8
-    {
1feee8
-      printf ("foo = %d\n", *ap);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-  if (*bp != 1)
1feee8
+  if (*ap != 0 || *bp != 1)
1feee8
     {
1feee8
-      printf ("bar = %d\n", *bp);
1feee8
+      printf ("foo = %d\nbar = %d\n", *ap, *bp);
1feee8
       result = 1;
1feee8
     }
1feee8
 
1feee8
 
1feee8
-  /* Get variables using local dynamic model.  */
1feee8
-  fputs ("get sum of foo and bar (LD)", stdout);
1feee8
-  ap = TLS_LD (foo);
1feee8
-  bp = TLS_LD (bar);
1feee8
+  /* Get variables using local dynamic model or TLSDESC.  */
1feee8
+  fputs ("get sum of foo and bar (LD or TLSDESC)", stdout);
1feee8
+  ap = &foo_ld;
1feee8
+  bp = &bar_ld;
1feee8
   printf (" = %d\n", *ap + *bp);
1feee8
   result |= *ap + *bp != 1;
1feee8
-  if (*ap != 0)
1feee8
-    {
1feee8
-      printf ("foo = %d\n", *ap);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-  if (*bp != 1)
1feee8
+  if (*ap != 0 || *bp != 1)
1feee8
     {
1feee8
-      printf ("bar = %d\n", *bp);
1feee8
+      printf ("foo = %d\nbar = %d\n", *ap, *bp);
1feee8
       result = 1;
1feee8
     }
1feee8
 
1feee8
 
1feee8
-  /* Get variables using generic dynamic model.  */
1feee8
-  fputs ("get sum of foo and bar (GD)", stdout);
1feee8
-  ap = TLS_GD (foo);
1feee8
-  bp = TLS_GD (bar);
1feee8
+  /* Get variables using general dynamic model or TLSDESC.  */
1feee8
+  fputs ("get sum of foo and bar (GD or TLSDESC)", stdout);
1feee8
+  ap = &foo_gd;
1feee8
+  bp = &bar_gd;
1feee8
   printf (" = %d\n", *ap + *bp);
1feee8
   result |= *ap + *bp != 1;
1feee8
-  if (*ap != 0)
1feee8
-    {
1feee8
-      printf ("foo = %d\n", *ap);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-  if (*bp != 1)
1feee8
+  if (*ap != 0 || *bp != 1)
1feee8
     {
1feee8
-      printf ("bar = %d\n", *bp);
1feee8
+      printf ("foo = %d\nbar = %d\n", *ap, *bp);
1feee8
       result = 1;
1feee8
     }
1feee8
 
1feee8
+
1feee8
   return result;
1feee8
 }
1feee8
 
1feee8
diff --git a/elf/tst-tls2.c b/elf/tst-tls2.c
1feee8
deleted file mode 100644
1feee8
index 963b8d6c88bba0b5..0000000000000000
1feee8
--- a/elf/tst-tls2.c
1feee8
+++ /dev/null
1feee8
@@ -1,82 +0,0 @@
1feee8
-/* glibc test for TLS in ld.so.  */
1feee8
-#include <stdio.h>
1feee8
-
1feee8
-#include "tls-macros.h"
1feee8
-
1feee8
-
1feee8
-/* Two 'int' variables in TLS.  */
1feee8
-VAR_INT_DEF(foo);
1feee8
-VAR_INT_DEF(bar);
1feee8
-
1feee8
-
1feee8
-static int
1feee8
-do_test (void)
1feee8
-{
1feee8
-  int result = 0;
1feee8
-  int *ap, *bp;
1feee8
-
1feee8
-
1feee8
-  /* Set the variable using the local exec model.  */
1feee8
-  puts ("set bar to 1 (LE)");
1feee8
-  ap = TLS_LE (bar);
1feee8
-  *ap = 1;
1feee8
-
1feee8
-
1feee8
-  /* Get variables using initial exec model.  */
1feee8
-  fputs ("get sum of foo and bar (IE)", stdout);
1feee8
-  ap = TLS_IE (foo);
1feee8
-  bp = TLS_IE (bar);
1feee8
-  printf (" = %d\n", *ap + *bp);
1feee8
-  result |= *ap + *bp != 1;
1feee8
-  if (*ap != 0)
1feee8
-    {
1feee8
-      printf ("foo = %d\n", *ap);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-  if (*bp != 1)
1feee8
-    {
1feee8
-      printf ("bar = %d\n", *bp);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-
1feee8
-
1feee8
-  /* Get variables using local dynamic model.  */
1feee8
-  fputs ("get sum of foo and bar (LD)", stdout);
1feee8
-  ap = TLS_LD (foo);
1feee8
-  bp = TLS_LD (bar);
1feee8
-  printf (" = %d\n", *ap + *bp);
1feee8
-  result |= *ap + *bp != 1;
1feee8
-  if (*ap != 0)
1feee8
-    {
1feee8
-      printf ("foo = %d\n", *ap);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-  if (*bp != 1)
1feee8
-    {
1feee8
-      printf ("bar = %d\n", *bp);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-
1feee8
-
1feee8
-  /* Get variables using generic dynamic model.  */
1feee8
-  fputs ("get sum of foo and bar (GD)", stdout);
1feee8
-  ap = TLS_GD (foo);
1feee8
-  bp = TLS_GD (bar);
1feee8
-  printf (" = %d\n", *ap + *bp);
1feee8
-  result |= *ap + *bp != 1;
1feee8
-  if (*ap != 0)
1feee8
-    {
1feee8
-      printf ("foo = %d\n", *ap);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-  if (*bp != 1)
1feee8
-    {
1feee8
-      printf ("bar = %d\n", *bp);
1feee8
-      result = 1;
1feee8
-    }
1feee8
-
1feee8
-  return result;
1feee8
-}
1feee8
-
1feee8
-
1feee8
-#include <support/test-driver.c>
1feee8
diff --git a/elf/tst-tls3.c b/elf/tst-tls3.c
1feee8
index 7e0abb4c58c8ff50..222b179626161897 100644
1feee8
--- a/elf/tst-tls3.c
1feee8
+++ b/elf/tst-tls3.c
1feee8
@@ -1,13 +1,12 @@
1feee8
 /* glibc test for TLS in ld.so.  */
1feee8
 #include <stdio.h>
1feee8
 
1feee8
-#include "tls-macros.h"
1feee8
 
1feee8
-
1feee8
-/* One define int variable, two externs.  */
1feee8
-COMMON_INT_DECL(foo);
1feee8
-VAR_INT_DECL(bar);
1feee8
-VAR_INT_DEF(baz);
1feee8
+__thread int foo, bar __attribute__ ((tls_model("initial-exec")));
1feee8
+__thread int baz __attribute__ ((tls_model("local-exec")));
1feee8
+extern __thread int foo_gd __attribute__ ((alias("foo"), tls_model("global-dynamic")));
1feee8
+extern __thread int bar_gd __attribute__ ((alias("bar"), tls_model("global-dynamic")));
1feee8
+extern __thread int baz_ld __attribute__ ((alias("baz"), tls_model("local-dynamic")));
1feee8
 
1feee8
 
1feee8
 extern int in_dso (void);
1feee8
@@ -22,23 +21,20 @@ do_test (void)
1feee8
 
1feee8
   /* Set the variable using the local exec model.  */
1feee8
   puts ("set baz to 3 (LE)");
1feee8
-  ap = TLS_LE (baz);
1feee8
-  *ap = 3;
1feee8
+  baz = 3;
1feee8
 
1feee8
 
1feee8
   /* Get variables using initial exec model.  */
1feee8
   puts ("set variables foo and bar (IE)");
1feee8
-  ap = TLS_IE (foo);
1feee8
-  *ap = 1;
1feee8
-  bp = TLS_IE (bar);
1feee8
-  *bp = 2;
1feee8
+  foo = 1;
1feee8
+  bar = 2;
1feee8
 
1feee8
 
1feee8
   /* Get variables using local dynamic model.  */
1feee8
   fputs ("get sum of foo, bar (GD) and baz (LD)", stdout);
1feee8
-  ap = TLS_GD (foo);
1feee8
-  bp = TLS_GD (bar);
1feee8
-  cp = TLS_LD (baz);
1feee8
+  ap = &foo_gd;
1feee8
+  bp = &bar_gd;
1feee8
+  cp = &baz_ld;
1feee8
   printf (" = %d\n", *ap + *bp + *cp);
1feee8
   result |= *ap + *bp + *cp != 6;
1feee8
   if (*ap != 1)
1feee8
diff --git a/elf/tst-tlsmod1.c b/elf/tst-tlsmod1.c
1feee8
index 8d9156791be9eabf..a448c4dc37eaf01b 100644
1feee8
--- a/elf/tst-tlsmod1.c
1feee8
+++ b/elf/tst-tlsmod1.c
1feee8
@@ -1,12 +1,12 @@
1feee8
 #include <stdio.h>
1feee8
 
1feee8
-#include "tls-macros.h"
1feee8
 
1feee8
+__thread int foo, bar __attribute__ ((tls_model("global-dynamic")));
1feee8
+extern __thread int baz __attribute__ ((tls_model("global-dynamic")));
1feee8
+extern __thread int foo_ie asm ("foo") __attribute__ ((tls_model("initial-exec")));
1feee8
+extern __thread int bar_ie asm ("bar") __attribute__ ((tls_model("initial-exec")));
1feee8
+extern __thread int baz_ie asm ("baz") __attribute__ ((tls_model("initial-exec")));
1feee8
 
1feee8
-/* One define int variable, two externs.  */
1feee8
-COMMON_INT_DEF(foo);
1feee8
-VAR_INT_DEF(bar);
1feee8
-VAR_INT_DECL(baz);
1feee8
 
1feee8
 extern int in_dso (void);
1feee8
 
1feee8
@@ -19,8 +19,8 @@ in_dso (void)
1feee8
   /* Get variables using initial exec model.  */
1feee8
   fputs ("get sum of foo and bar (IE)", stdout);
1feee8
   asm ("" ::: "memory");
1feee8
-  ap = TLS_IE (foo);
1feee8
-  bp = TLS_IE (bar);
1feee8
+  ap = &foo_ie;
1feee8
+  bp = &bar_ie;
1feee8
   printf (" = %d\n", *ap + *bp);
1feee8
   result |= *ap + *bp != 3;
1feee8
   if (*ap != 1)
1feee8
@@ -35,11 +35,11 @@ in_dso (void)
1feee8
     }
1feee8
 
1feee8
 
1feee8
-  /* Get variables using generic dynamic model.  */
1feee8
-  fputs ("get sum of foo and bar and baz (GD)", stdout);
1feee8
-  ap = TLS_GD (foo);
1feee8
-  bp = TLS_GD (bar);
1feee8
-  cp = TLS_GD (baz);
1feee8
+  /* Get variables using generic dynamic model or TLSDESC.  */
1feee8
+  fputs ("get sum of foo and bar and baz (GD or TLSDESC)", stdout);
1feee8
+  ap = &foo;
1feee8
+  bp = &bar;
1feee8
+  cp = &baz;
1feee8
   printf (" = %d\n", *ap + *bp + *cp);
1feee8
   result |= *ap + *bp + *cp != 6;
1feee8
   if (*ap != 1)
1feee8
diff --git a/elf/tst-tlsmod2.c b/elf/tst-tlsmod2.c
1feee8
index 40eb1407f864f64a..3223fe494bb7e1f0 100644
1feee8
--- a/elf/tst-tlsmod2.c
1feee8
+++ b/elf/tst-tlsmod2.c
1feee8
@@ -1,9 +1,7 @@
1feee8
 #include <stdio.h>
1feee8
 
1feee8
-#include "tls-macros.h"
1feee8
 
1feee8
-
1feee8
-COMMON_INT_DEF(foo);
1feee8
+__thread int foo;
1feee8
 
1feee8
 
1feee8
 int
1feee8
@@ -15,7 +13,7 @@ in_dso (int n, int *caller_foop)
1feee8
   puts ("foo");			/* Make sure PLT is used before macros.  */
1feee8
   asm ("" ::: "memory");
1feee8
 
1feee8
-  foop = TLS_GD (foo);
1feee8
+  foop = &foo;
1feee8
 
1feee8
   if (caller_foop != NULL && foop != caller_foop)
1feee8
     {
1feee8
diff --git a/elf/tst-tlsmod3.c b/elf/tst-tlsmod3.c
1feee8
index 6d186c47ee6ba104..d6e7498fd8331cb7 100644
1feee8
--- a/elf/tst-tlsmod3.c
1feee8
+++ b/elf/tst-tlsmod3.c
1feee8
@@ -1,10 +1,10 @@
1feee8
 #include <stdio.h>
1feee8
 
1feee8
-#include "tls-macros.h"
1feee8
 
1feee8
 extern int in_dso (int n, int *caller_foop);
1feee8
 
1feee8
-COMMON_INT_DEF(comm_n);
1feee8
+extern __thread int foo;
1feee8
+__thread int comm_n;
1feee8
 
1feee8
 
1feee8
 
1feee8
@@ -20,8 +20,8 @@ in_dso2 (void)
1feee8
   puts ("foo");			/* Make sure PLT is used before macros.  */
1feee8
   asm ("" ::: "memory");
1feee8
 
1feee8
-  foop = TLS_GD (foo);
1feee8
-  np = TLS_GD (comm_n);
1feee8
+  foop = &foo;
1feee8
+  np = &comm_;;
1feee8
 
1feee8
   if (n != *np)
1feee8
     {
1feee8
diff --git a/elf/tst-tlsmod4.c b/elf/tst-tlsmod4.c
1feee8
index 86889aac7e58bcf5..f38919a8a94861c1 100644
1feee8
--- a/elf/tst-tlsmod4.c
1feee8
+++ b/elf/tst-tlsmod4.c
1feee8
@@ -1,9 +1,7 @@
1feee8
 #include <stdio.h>
1feee8
 
1feee8
-#include "tls-macros.h"
1feee8
 
1feee8
-
1feee8
-COMMON_INT_DEF(baz);
1feee8
+__thread int baz;
1feee8
 
1feee8
 
1feee8
 int
1feee8
@@ -15,7 +13,7 @@ in_dso (int n, int *caller_bazp)
1feee8
   puts ("foo");			/* Make sure PLT is used before macros.  */
1feee8
   asm ("" ::: "memory");
1feee8
 
1feee8
-  bazp = TLS_GD (baz);
1feee8
+  bazp = &baz;
1feee8
 
1feee8
   if (caller_bazp != NULL && bazp != caller_bazp)
1feee8
     {
1feee8
diff --git a/elf/tst-tlsmod5.c b/elf/tst-tlsmod5.c
1feee8
index a97c7e5e0c69de26..3f39c5bdb76e0b5c 100644
1feee8
--- a/elf/tst-tlsmod5.c
1feee8
+++ b/elf/tst-tlsmod5.c
1feee8
@@ -1,3 +1 @@
1feee8
-#include "tls-macros.h"
1feee8
-
1feee8
-COMMON_INT_DEF(foo);
1feee8
+__thread int foo;
1feee8
diff --git a/elf/tst-tlsmod6.c b/elf/tst-tlsmod6.c
1feee8
index e968596dd4ef7756..7b3571f428b7243b 100644
1feee8
--- a/elf/tst-tlsmod6.c
1feee8
+++ b/elf/tst-tlsmod6.c
1feee8
@@ -1,3 +1 @@
1feee8
-#include "tls-macros.h"
1feee8
-
1feee8
-COMMON_INT_DEF(bar);
1feee8
+__thread int bar;
1feee8
diff --git a/sysdeps/powerpc/mod-tlsopt-powerpc.c b/sysdeps/powerpc/mod-tlsopt-powerpc.c
1feee8
index 51cc502f2860e969..d941024963fc7e6a 100644
1feee8
--- a/sysdeps/powerpc/mod-tlsopt-powerpc.c
1feee8
+++ b/sysdeps/powerpc/mod-tlsopt-powerpc.c
1feee8
@@ -1,11 +1,9 @@
1feee8
 /* shared library to test for __tls_get_addr optimization.  */
1feee8
 #include <stdio.h>
1feee8
 
1feee8
-#include "../../elf/tls-macros.h"
1feee8
 #include "dl-tls.h"
1feee8
 
1feee8
-/* common 'int' variable in TLS.  */
1feee8
-COMMON_INT_DEF(foo);
1feee8
+__thread int foo __attribute__ ((tls_model("global-dynamic")));
1feee8
 
1feee8
 
1feee8
 int
1feee8
@@ -14,7 +12,7 @@ tls_get_addr_opt_test (void)
1feee8
   int result = 0;
1feee8
 
1feee8
   /* Get variable using general dynamic model.  */
1feee8
-  int *ap = TLS_GD (foo);
1feee8
+  int *ap = &foo;
1feee8
   if (*ap != 0)
1feee8
     {
1feee8
       printf ("foo = %d\n", *ap);
1feee8
diff --git a/sysdeps/powerpc/tst-tlsifunc.c b/sysdeps/powerpc/tst-tlsifunc.c
1feee8
index 3095d41a68320d72..c8c0bada4547e1a4 100644
1feee8
--- a/sysdeps/powerpc/tst-tlsifunc.c
1feee8
+++ b/sysdeps/powerpc/tst-tlsifunc.c
1feee8
@@ -21,9 +21,9 @@
1feee8
 #include <stdint.h>
1feee8
 #include <inttypes.h>
1feee8
 #include <libc-symbols.h>
1feee8
-#include <tls-macros.h>
1feee8
 
1feee8
 __thread int bar;
1feee8
+extern __thread int bar_gd asm ("bar") __attribute__ ((tls_model("global-dynamic")));
1feee8
 static int *bar_ptr = NULL;
1feee8
 
1feee8
 static uint32_t resolver_platform = 0;
1feee8
@@ -57,7 +57,7 @@ get_platform (void)
1feee8
 void
1feee8
 init_foo (void)
1feee8
 {
1feee8
-  bar_ptr = TLS_GD (bar);
1feee8
+  bar_ptr = &bar_gd;
1feee8
 }
1feee8
 
1feee8
 int