mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-13 23:00:22 +00:00
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.
(cherry picked from commit 8090720a87
)
This commit is contained in:
parent
3b92252641
commit
94145309f5
@ -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]
|
||||
|
@ -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; })
|
||||
|
Loading…
Reference in New Issue
Block a user