diff mbox series

[2.27,COMMITTED,1/3] RISC-V: Do not initialize $gp in TLS macros.

Message ID 20180319184208.23770-1-aurelien@aurel32.net
State New
Headers show
Series [2.27,COMMITTED,1/3] RISC-V: Do not initialize $gp in TLS macros. | expand

Commit Message

Aurelien Jarno March 19, 2018, 6:42 p.m. UTC
From: DJ Delorie <dj@redhat.com>

RISC-V TLS doesn't require GP to be initialized, and doing so breaks
TLS in a shared object.

(cherry picked from commit 8090720a87e42fddc31396f6126112d4b8014d8e)
---
 ChangeLog                  |  4 ++++
 sysdeps/riscv/tls-macros.h | 20 +++-----------------
 2 files changed, 7 insertions(+), 17 deletions(-)

Comments

Aurelien Jarno March 19, 2018, 6:44 p.m. UTC | #1
On 2018-03-19 19:42, Aurelien Jarno wrote:
> From: DJ Delorie <dj@redhat.com>
> 
> RISC-V TLS doesn't require GP to be initialized, and doing so breaks
> TLS in a shared object.
> 
> (cherry picked from commit 8090720a87e42fddc31396f6126112d4b8014d8e)
> ---
>  ChangeLog                  |  4 ++++
>  sysdeps/riscv/tls-macros.h | 20 +++-----------------
>  2 files changed, 7 insertions(+), 17 deletions(-)

Oops as the subject says, those patches are for 2.27. Sorry for sending
them to the wrong list, please ignore.
diff mbox series

Patch

diff --git a/ChangeLog b/ChangeLog
index 17075925fa6..8b859f637d6 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-03-16  Rafal Luzynski  <digitalfreak@lingonborough.com>
 
 	[BZ #22963]
diff --git a/sysdeps/riscv/tls-macros.h b/sysdeps/riscv/tls-macros.h
index 5433ed9d16c..7f0dd926d0c 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; })