diff options
author | Chris Johns <chrisj@rtems.org> | 2012-12-08 09:07:30 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2012-12-08 09:07:30 +1100 |
commit | 4c10232ae7298504c124c33a8c0dc27c86dad5b5 (patch) | |
tree | f2745cad4ebf5cb07111191fe6f0cd8b7dd22cd5 /rld-symbols.cpp | |
parent | c6add3b2f603f4cf9be8bfe4bb4c27ccf9c086fa (diff) |
Add support to demand load relocation records.
Support has been added to load relocation record on demand. The
relocation records are not read when the object file is first
opened and read. They are read only when being written to the
output file. This save loading lots of records into memory
from libraries to be thrown away.
The RAP format now supports writing out relocation records.
Diffstat (limited to 'rld-symbols.cpp')
-rw-r--r-- | rld-symbols.cpp | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/rld-symbols.cpp b/rld-symbols.cpp index 3174ce4..982ef4d 100644 --- a/rld-symbols.cpp +++ b/rld-symbols.cpp @@ -50,43 +50,46 @@ namespace rld } symbol::symbol () - : object_ (0), + : index_ (-1), + object_ (0), references_ (0) { memset (&esym_, 0, sizeof (esym_)); } - symbol::symbol (const std::string& name, + symbol::symbol (int index, + const std::string& name, files::object& object, const elf::elf_sym& esym) - : name_ (name), + : index_ (index), + name_ (name), object_ (&object), esym_ (esym), references_ (0) { if (!object_) throw rld_error_at ("object pointer is 0"); - if (name_.empty ()) - throw rld_error_at ("name is empty in " + object.name ().full ()); if (is_cplusplus ()) denamgle_name (name_, demangled_); } - symbol::symbol (const std::string& name, const elf::elf_sym& esym) - : name_ (name), + symbol::symbol (int index, + const std::string& name, + const elf::elf_sym& esym) + : index_ (index), + name_ (name), object_ (0), esym_ (esym), references_ (0) { - if (name_.empty ()) - throw rld_error_at ("name is empty"); if (is_cplusplus ()) denamgle_name (name_, demangled_); } symbol::symbol (const std::string& name, const elf::elf_addr value) - : name_ (name), + : index_ (-1), + name_ (name), object_ (0), references_ (0) { @@ -96,7 +99,8 @@ namespace rld symbol::symbol (const char* name, const elf::elf_addr value) - : name_ (name), + : index_ (-1), + name_ (name), object_ (0), references_ (0) { @@ -104,6 +108,12 @@ namespace rld esym_.st_value = value; } + int + symbol::index () const + { + return index_; + } + const std::string& symbol::name () const { @@ -135,7 +145,7 @@ namespace rld } int - symbol::index () const + symbol::section_index () const { return esym_.st_shndx; } @@ -237,7 +247,8 @@ namespace rld break; } - out << binding + out << std::setw (4) << index_ + << ' ' << binding << ' ' << type << " 0x" << std::setw (8) << std::setfill ('0') << std::hex << es.st_value |