diff options
Diffstat (limited to 'rld-rap.cpp')
-rw-r--r-- | rld-rap.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/rld-rap.cpp b/rld-rap.cpp index 2b805cf..5150935 100644 --- a/rld-rap.cpp +++ b/rld-rap.cpp @@ -81,6 +81,18 @@ namespace rld typedef std::vector < relocation > relocations; /** + * Relocation symname sorter for the relocations container. + */ + class reloc_symname_compare + { + public: + bool operator () (const relocation& lhs, + const relocation& rhs) const { + return lhs.symname < rhs.symname; + } + }; + + /** * Relocation offset sorter for the relocations container. */ class reloc_offset_compare @@ -88,7 +100,9 @@ namespace rld public: bool operator () (const relocation& lhs, const relocation& rhs) const { - return lhs.offset < rhs.offset; + if (lhs.symname == rhs.symname) + return lhs.offset < rhs.offset; + else return false; } }; @@ -683,6 +697,9 @@ namespace rld std::stable_sort (sec.relocs.begin (), sec.relocs.end (), + reloc_symname_compare ()); + std::stable_sort (sec.relocs.begin (), + sec.relocs.end (), reloc_offset_compare ()); if (fsec.rela == true) |