summaryrefslogtreecommitdiffstats
path: root/third_party/android_platform
diff options
context:
space:
mode:
authorsimonb <simonb@chromium.org>2015-03-30 11:28:06 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-30 18:28:56 +0000
commit628a91cd6af3aa0dcec6119a77f3cc476ac3af82 (patch)
tree8e7b156c16d4d3cd9244daf3c844f639bec35bee /third_party/android_platform
parente156661a7dd822a182a805d0d94af00d70984e5a (diff)
downloadchromium_src-628a91cd6af3aa0dcec6119a77f3cc476ac3af82.zip
chromium_src-628a91cd6af3aa0dcec6119a77f3cc476ac3af82.tar.gz
chromium_src-628a91cd6af3aa0dcec6119a77f3cc476ac3af82.tar.bz2
Sync relocation packer to AOSP bionic.
Applies this change to the local code copy: https://android-review.googlesource.com/#/c/143878/ BUG=385553 Review URL: https://codereview.chromium.org/1042343002 Cr-Commit-Position: refs/heads/master@{#322815}
Diffstat (limited to 'third_party/android_platform')
-rw-r--r--third_party/android_platform/README.chromium1
-rw-r--r--third_party/android_platform/bionic/tools/relocation_packer/src/elf_file.h45
-rw-r--r--third_party/android_platform/bionic/tools/relocation_packer/src/leb128.h5
-rw-r--r--third_party/android_platform/bionic/tools/relocation_packer/src/main.cc3
-rw-r--r--third_party/android_platform/bionic/tools/relocation_packer/src/packer.h37
-rw-r--r--third_party/android_platform/bionic/tools/relocation_packer/src/sleb128.h5
6 files changed, 9 insertions, 87 deletions
diff --git a/third_party/android_platform/README.chromium b/third_party/android_platform/README.chromium
index 53f2429..ac97dbc 100644
--- a/third_party/android_platform/README.chromium
+++ b/third_party/android_platform/README.chromium
@@ -34,3 +34,4 @@ Android relocation packing tool details:
Create a nativehelper/ScopedFd.h to satisfy inclusion from main.cc
Create gyp build
Create gn build (currently packer only; no unit tests)
+ Apply https://android-review.googlesource.com/#/c/143878/
diff --git a/third_party/android_platform/bionic/tools/relocation_packer/src/elf_file.h b/third_party/android_platform/bionic/tools/relocation_packer/src/elf_file.h
index 73c3192..a749d50 100644
--- a/third_party/android_platform/bionic/tools/relocation_packer/src/elf_file.h
+++ b/third_party/android_platform/bionic/tools/relocation_packer/src/elf_file.h
@@ -4,53 +4,16 @@
// ELF shared object file updates handler.
//
-// Provides functions to remove relative relocations from the .rel.dyn
-// or .rela.dyn sections and pack into .android.rel.dyn or .android.rela.dyn,
-// and unpack to return the file to its pre-packed state.
-//
-// Files to be packed or unpacked must include an existing .android.rel.dyn
-// or android.rela.dyn section. A standard libchrome.<version>.so will not
-// contain this section, so the following can be used to add one:
-//
-// echo -n 'NULL' >/tmp/small
-// if file libchrome.<version>.so | grep -q 'ELF 32'; then
-// arm-linux-androideabi-objcopy
-// --add-section .android.rel.dyn=/tmp/small
-// libchrome.<version>.so libchrome.<version>.so.packed
-// else
-// aarch64-linux-android-objcopy
-// --add-section .android.rela.dyn=/tmp/small
-// libchrome.<version>.so libchrome.<version>.so.packed
-// fi
-// rm /tmp/small
-//
-// To use, open the file and pass the file descriptor to the constructor,
-// then pack or unpack as desired. Packing or unpacking will flush the file
-// descriptor on success. Example:
-//
-// int fd = open(..., O_RDWR);
-// ElfFile elf_file(fd);
-// bool status;
-// if (is_packing)
-// status = elf_file.PackRelocations();
-// else
-// status = elf_file.UnpackRelocations();
-// close(fd);
+// Provides functions to pack relocations in the .rel.dyn or .rela.dyn
+// sections, and unpack to return the file to its pre-packed state.
//
// SetPadding() causes PackRelocations() to pad .rel.dyn or .rela.dyn with
// NONE-type entries rather than cutting a hole out of the shared object
// file. This keeps all load addresses and offsets constant, and enables
// easier debugging and testing.
//
-// A packed shared object file has all of its relative relocations
-// removed from .rel.dyn or .rela.dyn, and replaced as packed data in
-// .android.rel.dyn or .android.rela.dyn respectively. The resulting file
-// is shorter than its non-packed original.
-//
-// Unpacking a packed file restores the file to its non-packed state, by
-// expanding the packed data in .android.rel.dyn or .android.rela.dyn,
-// combining the relative relocations with the data already in .rel.dyn
-// or .rela.dyn, and then writing back the now expanded section.
+// A packed shared object file is shorter than its non-packed original.
+// Unpacking a packed file restores the file to its non-packed state.
#ifndef TOOLS_RELOCATION_PACKER_SRC_ELF_FILE_H_
#define TOOLS_RELOCATION_PACKER_SRC_ELF_FILE_H_
diff --git a/third_party/android_platform/bionic/tools/relocation_packer/src/leb128.h b/third_party/android_platform/bionic/tools/relocation_packer/src/leb128.h
index 2c5b5d0..67fc4b8 100644
--- a/third_party/android_platform/bionic/tools/relocation_packer/src/leb128.h
+++ b/third_party/android_platform/bionic/tools/relocation_packer/src/leb128.h
@@ -4,9 +4,8 @@
// LEB128 encoder and decoder for packed relative relocations.
//
-// Run-length encoded relative relocations consist of a large number
-// of pairs of relatively small positive integer values. Encoding these as
-// LEB128 saves space.
+// Packed relocations consist of a large number of relatively small
+// integer values. Encoding these as LEB128 saves space.
//
// For more on LEB128 see http://en.wikipedia.org/wiki/LEB128.
diff --git a/third_party/android_platform/bionic/tools/relocation_packer/src/main.cc b/third_party/android_platform/bionic/tools/relocation_packer/src/main.cc
index 3f784e4..8e9de6d 100644
--- a/third_party/android_platform/bionic/tools/relocation_packer/src/main.cc
+++ b/third_party/android_platform/bionic/tools/relocation_packer/src/main.cc
@@ -4,9 +4,6 @@
// Tool to pack and unpack relative relocations in a shared library.
//
-// Packing removes relative relocations from .rel.dyn and writes them
-// in a more compact form to .android.rel.dyn. Unpacking does the reverse.
-//
// Invoke with -v to trace actions taken when packing or unpacking.
// Invoke with -p to pad removed relocations with R_*_NONE. Suppresses
// shrinking of .rel.dyn.
diff --git a/third_party/android_platform/bionic/tools/relocation_packer/src/packer.h b/third_party/android_platform/bionic/tools/relocation_packer/src/packer.h
index 8a57e62..63f50e2 100644
--- a/third_party/android_platform/bionic/tools/relocation_packer/src/packer.h
+++ b/third_party/android_platform/bionic/tools/relocation_packer/src/packer.h
@@ -3,43 +3,6 @@
// found in the LICENSE file.
// Pack relative relocations into a more compact form.
-//
-//
-// For relative relocations without addends (32 bit platforms)
-// -----------------------------------------------------------
-//
-// Applies two packing strategies. The first is run-length encoding, which
-// turns a large set of relative relocations into a much smaller set
-// of delta-count pairs, prefixed with a two-word header comprising the
-// count of pairs and the initial relocation offset. The second is LEB128
-// encoding, which compresses the result of run-length encoding.
-//
-// Once packed, data is prefixed by an identifier that allows for any later
-// versioning of packing strategies.
-//
-// A complete packed stream of relocations without addends might look
-// something like:
-//
-// "APR1" pairs init_offset count1 delta1 count2 delta2 ...
-// 41505231 f2b003 b08ac716 e001 04 01 10 ...
-//
-//
-// For relative relocations with addends (64 bit platforms)
-// --------------------------------------------------------
-//
-// Applies two packing strategies. The first is delta encoding, which
-// turns a large set of relative relocations into a smaller set
-// of offset and addend delta pairs, prefixed with a header indicating the
-// count of pairs. The second is signed LEB128 encoding, which compacts
-// the result of delta encoding.
-//
-// Once packed, data is prefixed by an identifier that allows for any later
-// versioning of packing strategies.
-//
-// A complete packed stream might look something like:
-//
-// "APA1" pairs offset_d1 addend_d1 offset_d2 addend_d2 ...
-// 41505232 f2b018 04 28 08 9f01 ...
#ifndef TOOLS_RELOCATION_PACKER_SRC_PACKER_H_
#define TOOLS_RELOCATION_PACKER_SRC_PACKER_H_
diff --git a/third_party/android_platform/bionic/tools/relocation_packer/src/sleb128.h b/third_party/android_platform/bionic/tools/relocation_packer/src/sleb128.h
index fa0a246..3a63f66 100644
--- a/third_party/android_platform/bionic/tools/relocation_packer/src/sleb128.h
+++ b/third_party/android_platform/bionic/tools/relocation_packer/src/sleb128.h
@@ -4,9 +4,8 @@
// SLEB128 encoder and decoder for packed relative relocations.
//
-// Delta encoded relative relocations consist of a large number
-// of pairs signed integer values, many with small values. Encoding these
-// as signed LEB128 saves space.
+// Packed relocations consist of a large number of relatively small
+// integer values. Encoding these as LEB128 saves space.
//
// For more on LEB128 see http://en.wikipedia.org/wiki/LEB128.