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

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

Issue 404553003: Create builds configured for ARM and AARCH64. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename DT tags to DT_ANDROID_REL_XXX 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.h ('k') | tools/relocation_packer/src/packer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/relocation_packer/src/packer.cc
diff --git a/tools/relocation_packer/src/packer.cc b/tools/relocation_packer/src/packer.cc
index f856a9b5f015a980ee75cb1593d22814f1db6ef0..c1d986260c4044dcf1987fa224b40d0055fa5199 100644
--- a/tools/relocation_packer/src/packer.cc
+++ b/tools/relocation_packer/src/packer.cc
@@ -2,28 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// TODO(simonb): Extend for 64-bit target libraries.
-
#include "packer.h"
-#include <string.h>
-#include <string>
#include <vector>
#include "debug.h"
+#include "elf_traits.h"
#include "leb128.h"
#include "run_length_encoder.h"
namespace relocation_packer {
-// Pack R_ARM_RELATIVE relocations into a run-length encoded packed
+// Pack ARM relative relocations into a run-length encoded packed
// representation.
void RelocationPacker::PackRelativeRelocations(
- const std::vector<Elf32_Rel>& relocations,
+ const std::vector<ELF::Rel>& relocations,
std::vector<uint8_t>* packed) {
// Run-length encode.
- std::vector<Elf32_Word> packed_words;
+ std::vector<ELF::Xword> packed_words;
RelocationRunLengthCodec codec;
codec.Encode(relocations, &packed_words);
@@ -44,18 +41,18 @@ void RelocationPacker::PackRelativeRelocations(
// Pad packed to a whole number of words. This padding will decode as
// LEB128 zeroes. Run-length decoding ignores it because encoding
// embeds the pairs count in the stream itself.
- while (packed->size() % sizeof(uint32_t))
+ while (packed->size() % sizeof(ELF::Word))
packed->push_back(0);
}
-// Unpack R_ARM_RELATIVE relocations from a run-length encoded packed
+// Unpack ARM relative relocations from a run-length encoded packed
// representation.
void RelocationPacker::UnpackRelativeRelocations(
const std::vector<uint8_t>& packed,
- std::vector<Elf32_Rel>* relocations) {
+ std::vector<ELF::Rel>* relocations) {
// LEB128 decode, after checking and stripping "APR1" prefix.
- std::vector<Elf32_Word> packed_words;
+ std::vector<ELF::Xword> packed_words;
Leb128Decoder decoder(packed);
CHECK(decoder.Dequeue() == 'A' && decoder.Dequeue() == 'P' &&
decoder.Dequeue() == 'R' && decoder.Dequeue() == '1');
« no previous file with comments | « tools/relocation_packer/src/packer.h ('k') | tools/relocation_packer/src/packer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698