[PATCH rtems-tools] linkers/rtems-syms: Generate TLS symbols
Kinsey Moore
kinsey.moore at oarcorp.com
Thu Jan 12 21:12:20 UTC 2023
When generating the symbol table for loadable modules, include TLS
symbols so that the modules can reference them.
---
linkers/rtems-syms.cpp | 5 +++++
rtemstoolkit/rld-elf.cpp | 1 +
rtemstoolkit/rld-symbols.cpp | 3 +++
3 files changed, 9 insertions(+)
diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp
index 5aa4d27..e5170e1 100644
--- a/linkers/rtems-syms.cpp
+++ b/linkers/rtems-syms.cpp
@@ -242,6 +242,11 @@ output_sym::operator ()(const rld::symbols::symtab::value_type& value)
c.write_line ("asm(\" .asciz \\\"" + sym.name () + "\\\"\");");
+ if (sym.type() == STT_TLS)
+ {
+ c.write_line ("asm(\" .type \\\"" + sym.name () + "\\\", %tls_object\");");
+ }
+
if (embed)
{
c.write_line ("#if __SIZEOF_POINTER__ == 8");
diff --git a/rtemstoolkit/rld-elf.cpp b/rtemstoolkit/rld-elf.cpp
index ffa3376..68efdbe 100644
--- a/rtemstoolkit/rld-elf.cpp
+++ b/rtemstoolkit/rld-elf.cpp
@@ -891,6 +891,7 @@ namespace rld
{
if (((stype == STT_NOTYPE) ||
(stype == STT_OBJECT) ||
+ (stype == STT_TLS) ||
(stype == STT_FUNC)) &&
((weak && (sbind == STB_WEAK)) ||
(!unresolved && ((local && (sbind == STB_LOCAL)) ||
diff --git a/rtemstoolkit/rld-symbols.cpp b/rtemstoolkit/rld-symbols.cpp
index 661b598..01291c0 100644
--- a/rtemstoolkit/rld-symbols.cpp
+++ b/rtemstoolkit/rld-symbols.cpp
@@ -277,6 +277,9 @@ namespace rld
case STT_FILE:
type = "STT_FILE ";
break;
+ case STT_TLS:
+ type = "STT_TLS ";
+ break;
default:
if ((type_val >= STT_LOPROC) && (type_val <= STT_HIPROC))
type = "STT_LOPROC(" + rld::to_string (type_val) + ")";
--
2.30.2
More information about the devel
mailing list