mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] fix tls access on arm targets before armv6k
@ 2018-08-23 14:10 Szabolcs Nagy
  2018-08-24 19:27 ` [PATCH v2] " Szabolcs Nagy
  0 siblings, 1 reply; 5+ messages in thread
From: Szabolcs Nagy @ 2018-08-23 14:10 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 216 bytes --]

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.

[-- Attachment #2: 0001-fix-tls-access-on-arm-targets-before-armv6k.patch --]
[-- Type: text/x-diff, Size: 1037 bytes --]

From 539dc72e6d75779082c862b2bb4463c2af4b7953 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
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 @@
 __attribute__((__visibility__("hidden")))
 void *__aeabi_read_tp_c(void)
 {
-	return (void *)((uintptr_t)__pthread_self()-8+sizeof(struct pthread));
+	return TP_ADJ(__pthread_self());
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-25  0:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-23 14:10 [PATCH] fix tls access on arm targets before armv6k Szabolcs Nagy
2018-08-24 19:27 ` [PATCH v2] " Szabolcs Nagy
2018-08-24 20:17   ` Rich Felker
2018-08-24 21:56     ` Szabolcs Nagy
2018-08-25  0:06       ` [PATCH] rewrite __aeabi_read_tp in asm Szabolcs Nagy

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).