Browse Source

xtensa: fix variable reference in TLS_LD

Use @DTPOFF instead of @TPOFF in TLS_LD as specified by the xtensa ABI.
DTPOFF produces variable offset relative to the variable's module TLS
block, it's the linker's job to replace it with TPOFF and adjust
surrounding code when the object file is linked into an executable.

This fixes tests tls/tst-tls[123] on xtensa that fail if built as PIE.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Waldemar Brodkorb 2 years ago
parent
commit
728e1e0ea5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      test/tls/tls-macros-xtensa.h

+ 2 - 2
test/tls/tls-macros-xtensa.h

@@ -15,7 +15,7 @@
      __asm__ ("movi  a8, _TLS_MODULE_BASE_@TLSFUNC\n\t"			\
 	  "movi a10, _TLS_MODULE_BASE_@TLSARG\n\t"			\
 	  "callx8.tls a8, _TLS_MODULE_BASE_@TLSCALL\n\t"		\
-	  "movi %0, " #x "@TPOFF\n\t"					\
+	  "movi %0, " #x "@DTPOFF\n\t"					\
 	  "add %0, %0, a10\n\t"						\
 	  : "=r" (__l)							\
 	  :								\
@@ -38,7 +38,7 @@
      __asm__ ("movi  a0, _TLS_MODULE_BASE_@TLSFUNC\n\t"			\
 	  "movi a2, _TLS_MODULE_BASE_@TLSARG\n\t"			\
 	  "callx0.tls a0, _TLS_MODULE_BASE_@TLSCALL\n\t"		\
-	  "movi %0, " #x "@TPOFF\n\t"					\
+	  "movi %0, " #x "@DTPOFF\n\t"					\
 	  "add %0, %0, a2\n\t"						\
 	  : "=r" (__l)							\
 	  :								\