Hello, This is a minor update of the change proposed by Rasmus at
https://gcc.gnu.org/pipermail/gcc/2020-May/232632.html to help builds on vxWorks 5. This variant refactors the code area a bit based on the observation that __gthread_enter/leave_tls_dtor_context is actually only relevant to VxWorks 6 at this stage. Tested by verifying that our vx 6.9 and 7.2 toolchains are still buildable and functional after the change. Olivier 2020-10-15 Rasmus Villemoes <r...@rasmusvillemoes.dk> Olivier Hainque <hain...@adacore.com> libgcc/ * config/gthr-vxworks-tls.c (VX_ENTER_TLS_DTOR): Nil except on VxWorks 6.
diff --git a/libgcc/config/gthr-vxworks-tls.c b/libgcc/config/gthr-vxworks-tls.c index fac25e305a01..8987e55c35ac 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.