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 | 72510af9d1e5a8b1325c14f41eb26b8bdde3d6d7 (patch) | |
tree | f84ee8cccad06cc33c3fcdfd82ad2c641b48dc0b | |
parent | cc54579b0b54bd349f1d69f40aa89607e32bf614 (diff) |
Sort the relocations by offset to make the overlay work.
-rw-r--r-- | rtems-rapper.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/rtems-rapper.cpp b/rtems-rapper.cpp index 9c539f2..a5abac9 100644 --- a/rtems-rapper.cpp +++ b/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; } - } } |