summaryrefslogtreecommitdiffstats
path: root/linkers
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-11-29 19:02:28 +1100
committerChris Johns <chrisj@rtems.org>2012-11-29 19:02:28 +1100
commit662c504ee04083c1efed21b68ddf6b22d9d55215 (patch)
treeaaeb4cb1abafa29aba8d9da6978c4e7e69619473 /linkers
parentAdd access to the value and info fields of a symbols. (diff)
downloadrtems-tools-662c504ee04083c1efed21b68ddf6b22d9d55215.tar.bz2
Add the index to the section.
The index is referenced in the symbol and relocation records of ELF files therefore we need to search for them.
Diffstat (limited to 'linkers')
-rw-r--r--linkers/rld-files.cpp17
-rw-r--r--linkers/rld-files.h6
2 files changed, 23 insertions, 0 deletions
diff --git a/linkers/rld-files.cpp b/linkers/rld-files.cpp
index 05f54b3..94508a1 100644
--- a/linkers/rld-files.cpp
+++ b/linkers/rld-files.cpp
@@ -902,6 +902,7 @@ namespace rld
section::section (const elf::section& es)
: name (es.name ()),
+ index (es.index ()),
type (es.type ()),
size (es.size ()),
alignment (es.alignment ()),
@@ -930,6 +931,22 @@ namespace rld
return size;
}
+ const section*
+ find (const sections& secs, const int index)
+ {
+ for (sections::const_iterator si = secs.begin ();
+ si != secs.end ();
+ ++si)
+ {
+ const section& sec = *si;
+
+ if (index == sec.index)
+ return &sec;
+ }
+
+ return 0;
+ }
+
object::object (archive& archive_, file& name_)
: image (name_),
archive_ (&archive_),
diff --git a/linkers/rld-files.h b/linkers/rld-files.h
index fb8c644..de49b4c 100644
--- a/linkers/rld-files.h
+++ b/linkers/rld-files.h
@@ -518,6 +518,7 @@ namespace rld
struct section
{
const std::string name; //< The name of the section.
+ const int index; //< The section's index in the object file.
const uint32_t type; //< The type of section.
const size_t size; //< The size of the section.
const uint32_t alignment; //< The alignment of the section.
@@ -550,6 +551,11 @@ namespace rld
size_t sum_sizes (const sections& secs);
/**
+ * Find the section that matches the index in the sections provided.
+ */
+ const section* find (const sections& secs, const int index);
+
+ /**
* The object file cab be in an archive or a file.
*/
class object: