From 8cc075c6a736fdde56ca2da03a868821695765f4 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 13 Sep 2026 23:33:14 +0200 Subject: Add threadvar section for thread-local variables --- gcc/gcc/elna-builtins.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc') 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(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()) { -- cgit v1.2.3