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

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

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/packer_unittest.cc ('k') | tools/relocation_packer/src/run_length_encoder.cc » ('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.h
diff --git a/tools/relocation_packer/src/run_length_encoder.h b/tools/relocation_packer/src/run_length_encoder.h
index cfb95f992ad5bb1fecbb4afc48c4b46eca655231..c7b165b7bc0012a7721e6c9e95963f8e1c38aba4 100644
--- a/tools/relocation_packer/src/run_length_encoder.h
+++ b/tools/relocation_packer/src/run_length_encoder.h
@@ -2,17 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Run-length encode and decode ARM relative relocations.
+// Run-length encode and decode relative relocations.
//
-// ARM relative relocations are the bulk of dynamic relocations (the
-// .rel.dyn section) in libchrome<version>.so, and the ELF standard
-// representation of them is wasteful.
+// Relative relocations are the bulk of dynamic relocations (the
+// .rel.dyn or .rela.dyn sections) in libchrome<version>.so, and the ELF
+// standard representation of them is wasteful. .rel.dyn contains
+// relocations without addends, .rela.dyn relocations with addends.
//
-// A relocation is 8 bytes (16 bytes on 64 bit plaforms), split into offset
-// and info fields. Offsets strictly increase, and each is commonly a
-// few bytes different from its predecessor. There are long runs where
-// the difference does not change. The info field is always 0x17. Example,
-// from 'readelf -x4 libchrome.<version>.so':
+// A relocation with no addend is 8 bytes on 32 bit platforms and 16 bytes
+// on 64 bit plaforms, split into offset and info fields. Offsets strictly
+// increase, and each is commonly a few bytes different from its predecessor.
+// There are long runs where the difference does not change. The info field
+// is constant. Example, from 'readelf -x4 libchrome.<version>.so' 32 bit:
//
// offset info offset info
// 808fef01 17000000 848fef01 17000000 ................
@@ -25,26 +26,26 @@
// by an encoded count of 6 and offset difference of 4:
//
// start count diff
-// 808fef01 00000006 00000004
+// 01ef8f80 00000006 00000004
//
-// Because ARM relative relocation offsets strictly increase, the complete
-// set of ARM relative relocations in libchrome.<version>.so can be
+// Because relative relocation offsets strictly increase, the complete
+// set of relative relocations in libchrome.<version>.so can be
// represented by a single start address followed by one or more difference
// and count encoded word pairs:
//
// start run1 count run1 diff run2 count run2 diff
-// 808fef01 00000006 00000004 00000010 00000008 ...
+// 01ef8f80 00000006 00000004 00000010 00000008 ...
//
-// Decoding regenerates ARM relative relocations beginning at address
+// Decoding regenerates relative relocations beginning at address
// 'start' and for each encoded run, incrementing the address by 'difference'
-// for 'count' iterations and emitting a new ARM relative relocation.
+// for 'count' iterations and emitting a new relative relocation.
//
// Once encoded, data is prefixed by a single word count of packed delta and
-// count pairs. A final run-length encoded ARM relative relocations vector
+// count pairs. A final run-length encoded relative relocations vector
// might therefore look something like:
//
// pairs start run 1 run 2 ... run 15
-// 0000000f 808fef01 00000006 00000004 00000010 00000008 ...
+// 0000000f 01ef8f80 00000006 00000004 00000010 00000008 ...
// Interpreted as:
// pairs=15 start=.. count=6,delta=4 count=16,delta=8
@@ -58,19 +59,19 @@
namespace relocation_packer {
-// A RelocationRunLengthCodec packs vectors of ARM relative relocations
+// A RelocationRunLengthCodec packs vectors of relative relocations
// into more compact forms, and unpacks them to reproduce the pre-packed data.
class RelocationRunLengthCodec {
public:
- // Encode ARM relative relocations into a more compact form.
- // |relocations| is a vector of ARM relative relocation structs.
+ // Encode relative relocations into a more compact form.
+ // |relocations| is a vector of relative relocation structs.
// |packed| is the vector of packed words into which relocations are packed.
static void Encode(const std::vector<ELF::Rel>& relocations,
std::vector<ELF::Xword>* packed);
- // Decode ARM relative relocations from their more compact form.
+ // Decode relative relocations from their more compact form.
// |packed| is the vector of packed relocations.
- // |relocations| is a vector of unpacked ARM relative relocation structs.
+ // |relocations| is a vector of unpacked relative relocation structs.
static void Decode(const std::vector<ELF::Xword>& packed,
std::vector<ELF::Rel>* relocations);
};
« no previous file with comments | « tools/relocation_packer/src/packer_unittest.cc ('k') | tools/relocation_packer/src/run_length_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698