]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
RISC-V: Do not initialize $gp in TLS macros.
authorDJ Delorie <dj@redhat.com>
Thu, 22 Feb 2018 19:28:47 +0000 (14:28 -0500)
committerDJ Delorie <dj@redhat.com>
Thu, 22 Feb 2018 19:28:47 +0000 (14:28 -0500)
RISC-V TLS doesn't require GP to be initialized, and doing so breaks
TLS in a shared object.

ChangeLog
sysdeps/riscv/tls-macros.h

index f918ce154909d67df4c140f6f8abdf62d3d8bd6f..bb787d65bb1ec53167e01c1871a65db096bd74f7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-02-22  DJ Delorie  <dj@delorie.com>
+
+       * sysdeps/riscv/tls-macros.h: Do not initialize $gp.
+
 2018-02-22  Siddhesh Poyarekar  <siddhesh@sourceware.org>
 
        * sysdeps/aarch64/strcmp.S (do_misaligned): Jump back to
index 5433ed9d16ce55b637e120db6d52a8c38bbb12c0..7f0dd926d0c0eb59e36625acc1ca4b19d86b2a2b 100644 (file)
 #include <sysdep.h>
 #include "dl-tls.h"
 
-#define LOAD_GP                                                \
-       ".option push\n\t"                              \
-       ".option norelax\n\t"                           \
-       "la gp, __global_pointer$\n\t"                  \
-       ".option pop\n\t"
-
-#define UNLOAD_GP
-
 #define TLS_GD(x)                                      \
        ({ void *__result;                              \
-       asm (LOAD_GP                                    \
-            "la.tls.gd %0, " #x "\n\t"                 \
-            UNLOAD_GP                                  \
+       asm ("la.tls.gd %0, " #x "\n\t"                 \
             : "=r" (__result));                        \
        __tls_get_addr (__result); })
 
 
 #define TLS_IE(x)                                      \
        ({ void *__result;                              \
-       asm (LOAD_GP                                    \
-            "la.tls.ie %0, " #x "\n\t"                 \
+       asm ("la.tls.ie %0, " #x "\n\t"                 \
             "add %0, %0, tp\n\t"                       \
-            UNLOAD_GP                                  \
             : "=r" (__result));                        \
        __result; })
 
 #define TLS_LE(x)                                      \
        ({ void *__result;                              \
-       asm (LOAD_GP                                    \
-            "lui %0, %%tprel_hi(" #x ")\n\t"           \
+       asm ("lui %0, %%tprel_hi(" #x ")\n\t"           \
             "add %0, %0, tp, %%tprel_add(" #x ")\n\t"  \
             "addi %0, %0, %%tprel_lo(" #x ")\n\t"      \
-            UNLOAD_GP                                  \
             : "=r" (__result));                        \
        __result; })