diff options
author | Chris Johns <chrisj@rtems.org> | 2012-12-31 18:11:47 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2012-12-31 18:11:47 +1100 |
commit | 06a2cf6eb32e24c532ac3ca5c793a110dc42a5a5 (patch) | |
tree | 44bfd3d5597e90a68db120a957bdcd2098003084 /linkers | |
parent | 544de91e99b9fbca79916424addb1b987257a6d3 (diff) |
Sort the relocations by offset to make the overlay work.
Diffstat (limited to 'linkers')
-rw-r--r-- | linkers/rtems-rapper.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/linkers/rtems-rapper.cpp b/linkers/rtems-rapper.cpp index 9c539f2..a5abac9 100644 --- a/linkers/rtems-rapper.cpp +++ b/linkers/rtems-rapper.cpp @@ -74,6 +74,18 @@ namespace rap typedef std::vector < relocation > relocations; /** + * Relocation offset sorter for the relocations container. + */ + class reloc_offset_compare + { + public: + bool operator () (const relocation& lhs, + const relocation& rhs) const { + return lhs.offset < rhs.offset; + } + }; + + /** * A RAP section. */ struct section @@ -285,6 +297,8 @@ namespace rap relocs.push_back (reloc); } + + std::stable_sort (relocs.begin (), relocs.end (), reloc_offset_compare ()); } } @@ -647,7 +661,10 @@ rap_show (rld::files::paths& raps, int count = 0; while (offset < r.strtab_size) { - std::cout << std::setw (16) << count++ << ": " + std::cout << std::setw (16) << count++ + << std::hex << std::setfill ('0') + << " (0x" << std::setw (6) << offset << "): " + << std::dec << std::setfill (' ') << (char*) &r.strtab[offset] << std::endl; offset += ::strlen ((char*) &r.strtab[offset]) + 1; } @@ -724,7 +741,6 @@ rap_show (rld::files::paths& raps, std::cout << std::setw (16) << " " << "No relocation table found." << std::endl; } - } } |