aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-09-13 23:33:14 +0200
committerEugen Wissner <belka@caraus.de>2026-09-13 23:33:14 +0200
commit8cc075c6a736fdde56ca2da03a868821695765f4 (patch)
tree2dd14d3bc47e5bf00e612a0d792f5e33f2c7a81b /gcc
parent38a24d57067b657cde572f92210c5719091c88ff (diff)
downloadelna-8cc075c6a736fdde56ca2da03a868821695765f4.tar.gz
Add threadvar section for thread-local variables
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gcc/elna-builtins.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/gcc/elna-builtins.cc b/gcc/gcc/elna-builtins.cc
index a8e54c8..365ddb9 100644
--- a/gcc/gcc/elna-builtins.cc
+++ b/gcc/gcc/elna-builtins.cc
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3. If not see
#include "elna/gcc/elna1.h"
#include "stor-layout.h"
#include "stringpool.h"
+#include "varasm.h"
#include "elna/boot/evaluator.h"
#include "elna/gcc/elna-tree.h"
@@ -413,6 +414,13 @@ namespace elna::gcc
DECL_EXTERNAL(declaration_tree) =
static_cast<unsigned>(imported || variable_info->is_extern);
+
+ // The model depends on the linkage, so it is chosen after
+ // DECL_EXTERNAL is final.
+ if (variable_info->is_thread_local)
+ {
+ set_decl_tls_model(declaration_tree, decl_default_tls_model(declaration_tree));
+ }
}
else if (auto procedure_info = symbol_info->is_procedure())
{