[glibc/google/grte/v5-2.27/master] Work around clang arm not handling tlsgd relocs

Stan Shebs shebs@sourceware.org
Fri Nov 13 23:58:30 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9e72d1ac52e571b21cb5224a9a2fd11439e9bae7

commit 9e72d1ac52e571b21cb5224a9a2fd11439e9bae7
Author: Owen Anderson <oanderso@google.com>
Date:   Fri Nov 13 15:57:46 2020 -0800

    Work around clang arm not handling tlsgd relocs

Diff:
---
 elf/tst-tls1.c    | 8 ++++++--
 elf/tst-tls2.c    | 6 ++++--
 elf/tst-tls3.c    | 4 ++--
 elf/tst-tlsmod1.c | 3 ++-
 elf/tst-tlsmod2.c | 2 ++
 elf/tst-tlsmod3.c | 2 ++
 elf/tst-tlsmod4.c | 2 ++
 7 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/elf/tst-tls1.c b/elf/tst-tls1.c
index c31da56ce9..4bb5cc5274 100644
--- a/elf/tst-tls1.c
+++ b/elf/tst-tls1.c
@@ -39,7 +39,9 @@ do_test (void)
       result = 1;
     }
 
-
+  /* clang integrated assembler does not handle the tlsgd reloc needed by TLS_LD
+     and TLS_GD macros, so just skip this part of the test.  */
+#if !defined(__clang__) || !defined(__aarch64__)
   /* Get variables using local dynamic model.  */
   fputs ("get sum of foo and bar (LD)", stdout);
   ap = TLS_LD (foo);
@@ -56,8 +58,9 @@ do_test (void)
       printf ("bar = %d\n", *bp);
       result = 1;
     }
+#endif
 
-
+#if !defined(__clang__) || !defined(__aarch64__)
   /* Get variables using generic dynamic model.  */
   fputs ("get sum of foo and bar (GD)", stdout);
   ap = TLS_GD (foo);
@@ -74,6 +77,7 @@ do_test (void)
       printf ("bar = %d\n", *bp);
       result = 1;
     }
+#endif
 
   return result;
 }
diff --git a/elf/tst-tls2.c b/elf/tst-tls2.c
index 963b8d6c88..b16abad86d 100644
--- a/elf/tst-tls2.c
+++ b/elf/tst-tls2.c
@@ -39,7 +39,7 @@ do_test (void)
       result = 1;
     }
 
-
+#if !defined(__clang__) || !defined(__aarch64__)
   /* Get variables using local dynamic model.  */
   fputs ("get sum of foo and bar (LD)", stdout);
   ap = TLS_LD (foo);
@@ -56,8 +56,9 @@ do_test (void)
       printf ("bar = %d\n", *bp);
       result = 1;
     }
+#endif
 
-
+#if !defined(__clang__) || !defined(__aarch64__)
   /* Get variables using generic dynamic model.  */
   fputs ("get sum of foo and bar (GD)", stdout);
   ap = TLS_GD (foo);
@@ -74,6 +75,7 @@ do_test (void)
       printf ("bar = %d\n", *bp);
       result = 1;
     }
+#endif
 
   return result;
 }
diff --git a/elf/tst-tls3.c b/elf/tst-tls3.c
index 7e0abb4c58..58d7f2a591 100644
--- a/elf/tst-tls3.c
+++ b/elf/tst-tls3.c
@@ -33,7 +33,7 @@ do_test (void)
   bp = TLS_IE (bar);
   *bp = 2;
 
-
+#if !defined(__clang__) || !defined(__aarch64__)
   /* Get variables using local dynamic model.  */
   fputs ("get sum of foo, bar (GD) and baz (LD)", stdout);
   ap = TLS_GD (foo);
@@ -56,7 +56,7 @@ do_test (void)
       printf ("baz = %d\n", *cp);
       result = 1;
     }
-
+#endif
 
   result |= in_dso ();
 
diff --git a/elf/tst-tlsmod1.c b/elf/tst-tlsmod1.c
index 8d9156791b..5e73e2b35d 100644
--- a/elf/tst-tlsmod1.c
+++ b/elf/tst-tlsmod1.c
@@ -34,7 +34,7 @@ in_dso (void)
       result = 1;
     }
 
-
+#if !defined(__clang__) || !defined(__aarch64__)
   /* Get variables using generic dynamic model.  */
   fputs ("get sum of foo and bar and baz (GD)", stdout);
   ap = TLS_GD (foo);
@@ -57,6 +57,7 @@ in_dso (void)
       printf ("baz = %d\n", *cp);
       result = 1;
     }
+#endif
 
   return result;
 }
diff --git a/elf/tst-tlsmod2.c b/elf/tst-tlsmod2.c
index 40eb1407f8..bad37afdbe 100644
--- a/elf/tst-tlsmod2.c
+++ b/elf/tst-tlsmod2.c
@@ -15,6 +15,7 @@ in_dso (int n, int *caller_foop)
   puts ("foo");			/* Make sure PLT is used before macros.  */
   asm ("" ::: "memory");
 
+#if !defined(__clang__) || !defined(__aarch64__)
   foop = TLS_GD (foo);
 
   if (caller_foop != NULL && foop != caller_foop)
@@ -29,6 +30,7 @@ in_dso (int n, int *caller_foop)
     }
 
   *foop = 16;
+#endif
 
   return result;
 }
diff --git a/elf/tst-tlsmod3.c b/elf/tst-tlsmod3.c
index 6d186c47ee..80621eeb69 100644
--- a/elf/tst-tlsmod3.c
+++ b/elf/tst-tlsmod3.c
@@ -20,6 +20,7 @@ in_dso2 (void)
   puts ("foo");			/* Make sure PLT is used before macros.  */
   asm ("" ::: "memory");
 
+#if !defined(__clang__) || !defined(__aarch64__)
   foop = TLS_GD (foo);
   np = TLS_GD (comm_n);
 
@@ -32,6 +33,7 @@ in_dso2 (void)
   result |= in_dso (*foop = 42 + n++, foop);
 
   *foop = 16;
+#endif
 
   return result;
 }
diff --git a/elf/tst-tlsmod4.c b/elf/tst-tlsmod4.c
index 86889aac7e..303ab78633 100644
--- a/elf/tst-tlsmod4.c
+++ b/elf/tst-tlsmod4.c
@@ -15,6 +15,7 @@ in_dso (int n, int *caller_bazp)
   puts ("foo");			/* Make sure PLT is used before macros.  */
   asm ("" ::: "memory");
 
+#if !defined(__clang__) || !defined(__aarch64__)
   bazp = TLS_GD (baz);
 
   if (caller_bazp != NULL && bazp != caller_bazp)
@@ -29,6 +30,7 @@ in_dso (int n, int *caller_bazp)
     }
 
   *bazp = 16;
+#endif
 
   return result;
 }


More information about the Glibc-cvs mailing list