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

Unified Diff: third_party/android_platform/bionic/tools/relocation_packer/src/packer.cc

Issue 1099343004: Synchronize Android relocation packer source with AOSP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
Index: third_party/android_platform/bionic/tools/relocation_packer/src/packer.cc
diff --git a/third_party/android_platform/bionic/tools/relocation_packer/src/packer.cc b/third_party/android_platform/bionic/tools/relocation_packer/src/packer.cc
index 8e30612e550601a474d114b8e36d7a9dc8192984..433611faa9a8a66fe7c9a278a65f4229b409f70a 100644
--- a/third_party/android_platform/bionic/tools/relocation_packer/src/packer.cc
+++ b/third_party/android_platform/bionic/tools/relocation_packer/src/packer.cc
@@ -9,7 +9,6 @@
#include "debug.h"
#include "delta_encoder.h"
#include "elf_traits.h"
-#include "leb128.h"
#include "sleb128.h"
namespace relocation_packer {
@@ -28,32 +27,17 @@ void RelocationPacker<ELF>::PackRelocations(const std::vector<typename ELF::Rela
return;
Sleb128Encoder<typename ELF::Addr> sleb128_encoder;
- Leb128Encoder<typename ELF::Addr> leb128_encoder;
- std::vector<uint8_t> leb128_packed;
std::vector<uint8_t> sleb128_packed;
- leb128_encoder.EnqueueAll(packed_words);
- leb128_encoder.GetEncoding(&leb128_packed);
-
sleb128_encoder.EnqueueAll(packed_words);
sleb128_encoder.GetEncoding(&sleb128_packed);
- // TODO (simonb): Estimate savings on current android system image and consider using
- // one encoder for all packed relocations to reduce complexity.
- if (leb128_packed.size() <= sleb128_packed.size()) {
- packed->push_back('A');
- packed->push_back('P');
- packed->push_back('U');
- packed->push_back('2');
- packed->insert(packed->end(), leb128_packed.begin(), leb128_packed.end());
- } else {
- packed->push_back('A');
- packed->push_back('P');
- packed->push_back('S');
- packed->push_back('2');
- packed->insert(packed->end(), sleb128_packed.begin(), sleb128_packed.end());
- }
+ packed->push_back('A');
+ packed->push_back('P');
+ packed->push_back('S');
+ packed->push_back('2');
+ packed->insert(packed->end(), sleb128_packed.begin(), sleb128_packed.end());
}
// Unpack relative relocations from a run-length encoded packed
@@ -67,16 +51,11 @@ void RelocationPacker<ELF>::UnpackRelocations(
CHECK(packed.size() > 4 &&
packed[0] == 'A' &&
packed[1] == 'P' &&
- (packed[2] == 'U' || packed[2] == 'S') &&
+ packed[2] == 'S' &&
packed[3] == '2');
- if (packed[2] == 'U') {
- Leb128Decoder<typename ELF::Addr> decoder(packed, 4);
- decoder.DequeueAll(&packed_words);
- } else {
- Sleb128Decoder<typename ELF::Addr> decoder(packed, 4);
- decoder.DequeueAll(&packed_words);
- }
+ Sleb128Decoder<typename ELF::Addr> decoder(packed, 4);
+ decoder.DequeueAll(&packed_words);
RelocationDeltaCodec<ELF> codec;
codec.Decode(packed_words, relocations);

Powered by Google App Engine
This is Rietveld 408576698