aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2018-02-22 14:28:47 -0500
committerDJ Delorie <dj@redhat.com>2018-02-22 14:28:47 -0500
commit8090720a87e42fddc31396f6126112d4b8014d8e (patch)
tree8b2d3db3a589d3397525f4f72b8418afaa665bda
parent6ca24c43481e2c93a6eec362b04c3e77a35b28e3 (diff)
downloadglibc-8090720a87e42fddc31396f6126112d4b8014d8e.tar
glibc-8090720a87e42fddc31396f6126112d4b8014d8e.tar.gz
glibc-8090720a87e42fddc31396f6126112d4b8014d8e.tar.bz2
glibc-8090720a87e42fddc31396f6126112d4b8014d8e.zip
RISC-V: Do not initialize $gp in TLS macros.
RISC-V TLS doesn't require GP to be initialized, and doing so breaks TLS in a shared object.
-rw-r--r--ChangeLog4
-rw-r--r--sysdeps/riscv/tls-macros.h20
2 files changed, 7 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index f918ce1549..bb787d65bb 100644
--- 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
diff --git a/sysdeps/riscv/tls-macros.h b/sysdeps/riscv/tls-macros.h
index 5433ed9d16..7f0dd926d0 100644
--- a/sysdeps/riscv/tls-macros.h
+++ b/sysdeps/riscv/tls-macros.h
@@ -23,19 +23,9 @@
#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); })
@@ -43,19 +33,15 @@
#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; })