Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: tools/relocation_packer/src/run_length_encoder.cc

Issue 410933004: Extend relocation packing to cover arm64. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to master Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/relocation_packer/src/run_length_encoder.h ('k') | tools/relocation_packer/src/sleb128.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/relocation_packer/src/run_length_encoder.cc
diff --git a/tools/relocation_packer/src/run_length_encoder.cc b/tools/relocation_packer/src/run_length_encoder.cc
index 2d68bf4c1e892e4a4ea35a192bfad76428f6d931..2f2e1c315f30d684e659b475a6a98b3e2ae7187c 100644
--- a/tools/relocation_packer/src/run_length_encoder.cc
+++ b/tools/relocation_packer/src/run_length_encoder.cc
@@ -14,18 +14,22 @@ namespace relocation_packer {
namespace {
// Generate a vector of deltas between the r_offset fields of adjacent
-// ARM relative relocations.
+// relative relocations.
void GetDeltas(const std::vector<ELF::Rel>& relocations,
std::vector<ELF::Addr>* deltas) {
CHECK(relocations.size() >= 2);
for (size_t i = 0; i < relocations.size() - 1; ++i) {
- const ELF::Addr first = relocations[i].r_offset;
- const ELF::Addr second = relocations[i + 1].r_offset;
+ const ELF::Rel* first = &relocations[i];
+ CHECK(ELF_R_TYPE(first->r_info) == ELF::kRelativeRelocationCode);
+
+ const ELF::Rel* second = &relocations[i + 1];
+ CHECK(ELF_R_TYPE(second->r_info) == ELF::kRelativeRelocationCode);
+
// Requires that offsets are 'strictly increasing'. The packing
// algorithm fails if this does not hold.
- CHECK(second > first);
- deltas->push_back(second - first);
+ CHECK(second->r_offset > first->r_offset);
+ deltas->push_back(second->r_offset - first->r_offset);
}
}
@@ -92,7 +96,7 @@ void Uncondense(ELF::Addr addr,
} // namespace
-// Encode ARM relative relocations into a run-length encoded (packed)
+// Encode relative relocations into a run-length encoded (packed)
// representation.
void RelocationRunLengthCodec::Encode(const std::vector<ELF::Rel>& relocations,
std::vector<ELF::Xword>* packed) {
@@ -116,7 +120,7 @@ void RelocationRunLengthCodec::Encode(const std::vector<ELF::Rel>& relocations,
packed->at(0) = (packed->size() - 2) >> 1;
}
-// Decode ARM relative relocations from a run-length encoded (packed)
+// Decode relative relocations from a run-length encoded (packed)
// representation.
void RelocationRunLengthCodec::Decode(const std::vector<ELF::Xword>& packed,
std::vector<ELF::Rel>* relocations) {
« no previous file with comments | « tools/relocation_packer/src/run_length_encoder.h ('k') | tools/relocation_packer/src/sleb128.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698