summaryrefslogtreecommitdiff
path: root/rtemstoolkit/rld-files.cpp
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-10-30 17:55:18 +1100
committerChris Johns <chrisj@rtems.org>2014-10-30 17:55:18 +1100
commitfdb1fe685ab60de784b5f20413fe54cd70a01ff2 (patch)
tree05b75e65b705a08c46220416423d64331a68752e /rtemstoolkit/rld-files.cpp
parentaac294948caf0e0595a32dab8194d090ce3dd1b9 (diff)
linkers: Add base image symbol to ELF object file generation.
This change adds support to the rtems-syms code to generate a suitable ELF object you can link to the base image kernel in the embed mode or you can load with the run-time load mode. The change fixes a bug in the framework where local ELF symbols were being placed in the external symbol table. The external symbol table has been removed and a global, weak and local set of tables is now provided as this is more aligned with the ELF format.
Diffstat (limited to 'rtemstoolkit/rld-files.cpp')
-rw-r--r--rtemstoolkit/rld-files.cpp38
1 files changed, 30 insertions, 8 deletions
diff --git a/rtemstoolkit/rld-files.cpp b/rtemstoolkit/rld-files.cpp
index 03310e8..995b059 100644
--- a/rtemstoolkit/rld-files.cpp
+++ b/rtemstoolkit/rld-files.cpp
@@ -1040,10 +1040,32 @@ namespace rld
rld::symbols::pointers syms;
- elf ().get_symbols (syms, false, local, false, true);
+ if (local)
+ {
+ elf ().get_symbols (syms, false, true, false, false);
+
+ if (rld::verbose () >= RLD_VERBOSE_TRACE_SYMS)
+ std::cout << "object:load-sym: local: total "
+ << syms.size () << std::endl;
+
+ for (symbols::pointers::iterator si = syms.begin ();
+ si != syms.end ();
+ ++si)
+ {
+ symbols::symbol& sym = *(*si);
+
+ if (rld::verbose () >= RLD_VERBOSE_TRACE_SYMS)
+ std::cout << "object:load-sym: local: " << sym << std::endl;
+
+ sym.set_object (*this);
+ symbols.add_local (sym);
+ }
+ }
+
+ elf ().get_symbols (syms, false, false, true, false);
if (rld::verbose () >= RLD_VERBOSE_TRACE_SYMS)
- std::cout << "object:load-sym: exported: total "
+ std::cout << "object:load-sym: weak: total "
<< syms.size () << std::endl;
for (symbols::pointers::iterator si = syms.begin ();
@@ -1053,17 +1075,17 @@ namespace rld
symbols::symbol& sym = *(*si);
if (rld::verbose () >= RLD_VERBOSE_TRACE_SYMS)
- std::cout << "object:load-sym: exported: " << sym << std::endl;
+ std::cout << "object:load-sym: weak: " << sym << std::endl;
sym.set_object (*this);
- symbols.add_external (sym);
+ symbols.add_weak (sym);
externals.push_back (&sym);
}
- elf ().get_symbols (syms, false, false, true, false);
+ elf ().get_symbols (syms, false, false, false, true);
if (rld::verbose () >= RLD_VERBOSE_TRACE_SYMS)
- std::cout << "object:load-sym: weak: total "
+ std::cout << "object:load-sym: global: total "
<< syms.size () << std::endl;
for (symbols::pointers::iterator si = syms.begin ();
@@ -1073,10 +1095,10 @@ namespace rld
symbols::symbol& sym = *(*si);
if (rld::verbose () >= RLD_VERBOSE_TRACE_SYMS)
- std::cout << "object:load-sym: weak: " << sym << std::endl;
+ std::cout << "object:load-sym: global: " << sym << std::endl;
sym.set_object (*this);
- symbols.add_weak (sym);
+ symbols.add_global (sym);
externals.push_back (&sym);
}