From a2da19dadea64aea05aff6dc8069a6a2a88c0888 Mon Sep 17 00:00:00 2001 From: Liu Yan Date: Tue, 22 Aug 2023 16:58:00 +0800 Subject: [PATCH] Reserved tls slot for feature extension Issue: https://gitee.com/openharmony/third_party_musl/issues/I7V42G test: libctest Signed-off-by: Liu Yan --- porting/linux/user/src/internal/pthread_impl.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/porting/linux/user/src/internal/pthread_impl.h b/porting/linux/user/src/internal/pthread_impl.h index 1faf28d2..eedfd193 100644 --- a/porting/linux/user/src/internal/pthread_impl.h +++ b/porting/linux/user/src/internal/pthread_impl.h @@ -29,6 +29,7 @@ #include "pthread_arch.h" #define pthread __pthread +#define TLS_RESERVE_SLOT 15 struct pthread { /* Part 1 -- these fields may be external or @@ -83,6 +84,13 @@ struct pthread { /* Part 3 -- the positions of these fields relative to * the end of the structure is external and internal ABI. */ #ifdef TLS_ABOVE_TP + /* The tls_slots will be accessed by kernel, so don't use it. + * To solve the problem that the kernel isn't synchronized with the musl, + * so make pre/post reserved slots for musl. + * pre-reserved : tls_slots[0-4] + * kernel used : tls_slots[5-9] + * post-reserved : tls_slot[10-14] */ + void *tls_slots[TLS_RESERVE_SLOT]; uintptr_t canary; uintptr_t *dtv; #endif -- GitLab