* [patch] vxworks: refactor VX_ENTER/LEAVE_TLS_DTOR
@ 2020-10-16 9:38 Olivier Hainque
0 siblings, 0 replies; only message in thread
From: Olivier Hainque @ 2020-10-16 9:38 UTC (permalink / raw)
To: GCC Patches; +Cc: Olivier Hainque, Rasmus Villemoes
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
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 <rv@rasmusvillemoes.dk>
Olivier Hainque <hainque@adacore.com>
libgcc/
* config/gthr-vxworks-tls.c (VX_ENTER_TLS_DTOR): Nil
except on VxWorks 6.
[-- Attachment #2: enter_tls_vx6.txt --]
[-- Type: text/plain, Size: 1743 bytes --]
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-16 9:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 9:38 [patch] vxworks: refactor VX_ENTER/LEAVE_TLS_DTOR Olivier Hainque
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 read-only IMAP folder(s) and NNTP newsgroup(s).