fix tls access on arm targets before armv6k

Submitted by Szabolcs Nagy on Aug. 23, 2018, 2:10 p.m.


Message ID
State New
Series "fix tls access on arm targets before armv6k"
Headers show

Commit Message

Szabolcs Nagy Aug. 23, 2018, 2:10 p.m.
fixing the 'large tls alignment on tls above tp targets' issue
introduced a regression on arm which i didnt notice because i
only tested it with armv7-a code gen.

fortunately there was no release since that commit.

Patch hide | download patch | download mbox

From 539dc72e6d75779082c862b2bb4463c2af4b7953 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <>
Date: Thu, 23 Aug 2018 10:57:34 +0000
Subject: [PATCH] fix tls access on arm targets before armv6k

commit 610c5a8524c3d6cd3ac5a5f1231422e7648a3791 changed the thread
pointer setup so tp points at the end of the pthread struct on arm,
but failed to update __aeabi_read_tp so it was off by 8.

this broke tls access in code that is compiled with -mtp=soft, which
is the default when target arch is pre armv6k or thumb1.
 src/thread/arm/__aeabi_read_tp_c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/thread/arm/__aeabi_read_tp_c.c b/src/thread/arm/__aeabi_read_tp_c.c
index 654bdc57..0c56d613 100644
--- a/src/thread/arm/__aeabi_read_tp_c.c
+++ b/src/thread/arm/__aeabi_read_tp_c.c
@@ -4,5 +4,5 @@ 
 void *__aeabi_read_tp_c(void)
-	return (void *)((uintptr_t)__pthread_self()-8+sizeof(struct pthread));
+	return TP_ADJ(__pthread_self());