[Bug jit/95415] Add support for thread-local variables
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415 Antoni changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |FIXED --- Comment #6 from Antoni --- Merged in master.
[Bug jit/95415] Add support for thread-local variables
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415 --- Comment #5 from CVS Commits --- The master branch has been updated by Antoni Boucher : https://gcc.gnu.org/g:c6b7f68bfd61fcd02842e672476f9924d5ba1d3c commit r12-5913-gc6b7f68bfd61fcd02842e672476f9924d5ba1d3c Author: Antoni Boucher Date: Sat Dec 11 19:01:15 2021 -0500 libgccjit: Add support for TLS variable [PR95415] 2021-12-11 Antoni Boucher gcc/jit/ PR target/95415 * docs/topics/compatibility.rst (LIBGCCJIT_ABI_17): New ABI tag. * docs/topics/expressions.rst: Add document for the function gcc_jit_lvalue_set_tls_model. * jit-playback.h: New function (set_tls_model). * jit-recording.c: New function (set_tls_model), new variables (tls_models and tls_model_enum_strings) and support for setting the tls model. * jit-recording.h: New function (set_tls_model) and new field m_tls_model. * libgccjit.c: New function (gcc_jit_lvalue_set_tls_model). * libgccjit.h: New function (gcc_jit_lvalue_set_tls_model) and new enum (gcc_jit_tls_model). * libgccjit.map (LIBGCCJIT_ABI_17): New ABI tag. gcc/testsuite/ PR target/95415 * jit.dg/all-non-failing-tests.h: Add test-tls.c. * jit.dg/test-tls.c: New test.
[Bug jit/95415] Add support for thread-local variables
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415 David Malcolm changed: What|Removed |Added Status|ASSIGNED|WAITING --- Comment #4 from David Malcolm --- Thanks for working on this. I think the current state is that I reviewed the patch here: https://gcc.gnu.org/pipermail/jit/2021q2/001306.html and found some issues with it, so this is waiting on an updated patch.
[Bug jit/95415] Add support for thread-local variables
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415 --- Comment #3 from Antoni --- Created attachment 50842 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50842=edit Patch to add this feature I created a patch to add TLS variables.
[Bug jit/95415] Add support for thread-local variables
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415 Richard Biener changed: What|Removed |Added Status|NEW |ASSIGNED
[Bug jit/95415] Add support for thread-local variables
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415 Andrew Pinski changed: What|Removed |Added Severity|normal |enhancement Ever confirmed|0 |1 Last reconfirmed||2021-04-21 Status|UNCONFIRMED |NEW --- Comment #2 from Andrew Pinski --- Confirmed.
[Bug jit/95415] Add support for thread-local variables
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415 --- Comment #1 from David Malcolm --- Perhaps, but it looks non-trivial. Notes to self: c/c-tree.h: struct c_declspecs has: /* Whether "__thread" or "_Thread_local" was specified. */ BOOL_BITFIELD thread_p : 1; /* Whether "__thread" rather than "_Thread_local" was specified. */ BOOL_BITFIELD thread_gnu_p : 1; tree.h has: /* In a VAR_DECL, the model to use if the data should be allocated from thread-local storage. */ #define DECL_TLS_MODEL(NODE) decl_tls_model (NODE) /* In a VAR_DECL, nonzero if the data should be allocated from thread-local storage. */ #define DECL_THREAD_LOCAL_P(NODE) \ ((TREE_STATIC (NODE) || DECL_EXTERNAL (NODE)) && decl_tls_model (NODE) >= TLS_MODEL_REAL) decl_tls_model/set_decl_tls_model get/set a field of the varpool_node, based on this enum in coretypes.h: /* The thread-local storage model associated with a given VAR_DECL or SYMBOL_REF. This isn't used much, but both trees and RTL refer to it, so it's here. */ enum tls_model { TLS_MODEL_NONE, TLS_MODEL_EMULATED, TLS_MODEL_REAL, TLS_MODEL_GLOBAL_DYNAMIC = TLS_MODEL_REAL, TLS_MODEL_LOCAL_DYNAMIC, TLS_MODEL_INITIAL_EXEC, TLS_MODEL_LOCAL_EXEC };