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

Side by Side Diff: tools/relocation_packer/src/packer.h

Issue 404553003: Create builds configured for ARM and AARCH64. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Purge unused includes. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Pack R_ARM_RELATIVE relocations into a more compact form. 5 // Pack ARM relative relocations into a more compact form.
6 // 6 //
7 // Applies two packing strategies. The first is run-length encoding, which 7 // Applies two packing strategies. The first is run-length encoding, which
8 // turns a large set of R_ARM_RELATIVE relocations into a much smaller set 8 // turns a large set of ARM relative relocations into a much smaller set
9 // of delta-count pairs, prefixed with a two-word header comprising the 9 // of delta-count pairs, prefixed with a two-word header comprising the
10 // count of pairs and the initial relocation offset. The second is LEB128 10 // count of pairs and the initial relocation offset. The second is LEB128
11 // encoding, which compacts the result of run-length encoding. 11 // encoding, which compacts the result of run-length encoding.
12 // 12 //
13 // Once packed, data is prefixed by an identifier that allows for any later 13 // Once packed, data is prefixed by an identifier that allows for any later
14 // versioning of packing strategies. 14 // versioning of packing strategies.
15 // 15 //
16 // A complete packed stream might look something like: 16 // A complete packed stream might look something like:
17 // 17 //
18 // "APR1" pairs init_offset count1 delta1 count2 delta2 ... 18 // "APR1" pairs init_offset count1 delta1 count2 delta2 ...
19 // 41505231 f2b003 b08ac716 e001 04 01 10 ... 19 // 41505231 f2b003 b08ac716 e001 04 01 10 ...
20 20
21 #ifndef TOOLS_RELOCATION_PACKER_SRC_PACKER_H_ 21 #ifndef TOOLS_RELOCATION_PACKER_SRC_PACKER_H_
22 #define TOOLS_RELOCATION_PACKER_SRC_PACKER_H_ 22 #define TOOLS_RELOCATION_PACKER_SRC_PACKER_H_
23 23
24 #include <stdint.h> 24 #include <stdint.h>
25 #include <string.h>
26 #include <vector> 25 #include <vector>
27 26
28 #include "elf.h" 27 #include "elf.h"
28 #include "elf_traits.h"
29 29
30 namespace relocation_packer { 30 namespace relocation_packer {
31 31
32 // A RelocationPacker packs vectors of R_ARM_RELATIVE relocations into more 32 // A RelocationPacker packs vectors of ARM relative relocations into more
33 // compact forms, and unpacks them to reproduce the pre-packed data. 33 // compact forms, and unpacks them to reproduce the pre-packed data.
34 class RelocationPacker { 34 class RelocationPacker {
35 public: 35 public:
36 // Pack R_ARM_RELATIVE relocations into a more compact form. 36 // Pack ARM relative relocations into a more compact form.
37 // |relocations| is a vector of R_ARM_RELATIVE relocation structs. 37 // |relocations| is a vector of ARM relative relocation structs.
38 // |packed| is the vector of packed bytes into which relocations are packed. 38 // |packed| is the vector of packed bytes into which relocations are packed.
39 static void PackRelativeRelocations(const std::vector<Elf32_Rel>& relocations, 39 static void PackRelativeRelocations(const std::vector<ELF::Rel>& relocations,
40 std::vector<uint8_t>* packed); 40 std::vector<uint8_t>* packed);
41 41
42 // Unpack R_ARM_RELATIVE relocations from their more compact form. 42 // Unpack ARM relative relocations from their more compact form.
43 // |packed| is the vector of packed relocations. 43 // |packed| is the vector of packed relocations.
44 // |relocations| is a vector of unpacked R_ARM_RELATIVE relocation structs. 44 // |relocations| is a vector of unpacked ARM relative relocation structs.
45 static void UnpackRelativeRelocations(const std::vector<uint8_t>& packed, 45 static void UnpackRelativeRelocations(const std::vector<uint8_t>& packed,
46 std::vector<Elf32_Rel>* relocations); 46 std::vector<ELF::Rel>* relocations);
47 }; 47 };
48 48
49 } // namespace relocation_packer 49 } // namespace relocation_packer
50 50
51 #endif // TOOLS_RELOCATION_PACKER_SRC_PACKER_H_ 51 #endif // TOOLS_RELOCATION_PACKER_SRC_PACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698