From 4cde835fd7add8979ab92fd27ee7efcea235f763 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Fri, 2 Oct 2020 12:58:45 +0000 Subject: [PATCH] Stub out VX_ENTER_TLS_DTOR for VxWorks != 6 As of today, the __gthread_enter/leave entry points are only meaningful on VxWorks 6. Refactor the VX_ENTER_TLS_DTOR macros accordingly. 2020-10-15 Rasmus Villemoes libgcc/ * config/gthr-vxworks-tls.c (VX_ENTER_TLS_DTOR): Nil except on VxWorks 6. Co-authored-by: Olivier Hainque --- libgcc/config/gthr-vxworks-tls.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libgcc/config/gthr-vxworks-tls.c b/libgcc/config/gthr-vxworks-tls.c index fac25e305a0..8987e55c35a 100644 --- a/libgcc/config/gthr-vxworks-tls.c +++ b/libgcc/config/gthr-vxworks-tls.c @@ -94,7 +94,9 @@ static int self_owner; static volatile int delete_hook_installed; /* TLS data access internal API. A straight __thread variable starting with - VxWorks 7, a pointer returned by kernel provided routines otherwise. */ + VxWorks 7, a pointer returned by kernel provided routines otherwise. And + on VxWorks 6, the kernel expects us to notify entry/exit of regions + handling such variables by calls to kernel provided __gthread routines. */ #if _VXWORKS_MAJOR_GE(7) @@ -103,23 +105,29 @@ static __thread struct tls_data *__gthread_tls_data; #define VX_GET_TLS_DATA() __gthread_tls_data #define VX_SET_TLS_DATA(x) __gthread_tls_data = (x) -#define VX_ENTER_TLS_DTOR() -#define VX_LEAVE_TLS_DTOR() - #else extern void *__gthread_get_tls_data (void); extern void __gthread_set_tls_data (void *data); -extern void __gthread_enter_tls_dtor_context (void); -extern void __gthread_leave_tls_dtor_context (void); - #define VX_GET_TLS_DATA() __gthread_get_tls_data() #define VX_SET_TLS_DATA(x) __gthread_set_tls_data(x) +#endif + +#ifdef _VXWORKS_MAJOR_EQ(6) + +extern void __gthread_enter_tls_dtor_context (void); +extern void __gthread_leave_tls_dtor_context (void); + #define VX_ENTER_TLS_DTOR() __gthread_enter_tls_dtor_context () #define VX_LEAVE_TLS_DTOR() __gthread_leave_tls_dtor_context () +#else + +#define VX_ENTER_TLS_DTOR() +#define VX_LEAVE_TLS_DTOR() + #endif /* This is a global structure which records all of the active keys.