From 5a0821664c0cb3192f3c1a9b10eab072059c6e5d Mon Sep 17 00:00:00 2001 From: "simonb@chromium.org" Date: Thu, 24 Jul 2014 10:57:40 +0000 Subject: [PATCH] Switch from ELF CPU-specific to OS-specific DT_ tags. Use the OS-specific range for packed relocation extension DT_ tags. Name throughout as DT_ANDROID_REL_ rather than DT_ANDROID_ARM_REL_. Change test data to match. BUG=385553 Review URL: https://codereview.chromium.org/407093003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285179 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/android_crazy_linker/README.chromium | 2 ++ .../src/src/crazy_linker_shared_library.cpp | 18 +++++++++++------- tools/relocation_packer/README.TXT | 4 ++-- tools/relocation_packer/src/elf_file.cc | 4 ++-- .../test_data/elf_file_unittest_relocs_packed.so | Bin 7995 -> 7995 bytes 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/third_party/android_crazy_linker/README.chromium b/third_party/android_crazy_linker/README.chromium index 485d50a8abf0..6f5d3059b3db 100644 --- a/third_party/android_crazy_linker/README.chromium +++ b/third_party/android_crazy_linker/README.chromium @@ -31,3 +31,5 @@ Local Modifications: - Improve permission denied message to mention upgrading from L-preview. - Fix for crbug/394306 (Chrome crashes during startup ... on Arm64 AAW15) + +- Move packed relocation dynamic tags from DT_LOPROC range to DT_LOOS range. diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp index 6a566085fbcd..191e5dccd0a1 100644 --- a/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp +++ b/third_party/android_crazy_linker/src/src/crazy_linker_shared_library.cpp @@ -58,11 +58,15 @@ #define DT_PREINIT_ARRAYSZ 33 #endif -// Processor-specific extension dynamic tags for packed relocations. +#ifndef DT_LOOS +#define DT_LOOS 0x6000000d +#endif + +// Extension dynamic tags for packed relocations. #ifdef __arm__ -#define DT_ANDROID_ARM_REL_OFFSET (DT_LOPROC) -#define DT_ANDROID_ARM_REL_SIZE (DT_LOPROC + 1) +#define DT_ANDROID_REL_OFFSET (DT_LOOS) +#define DT_ANDROID_REL_SIZE (DT_LOOS + 1) #endif // __arm__ @@ -336,13 +340,13 @@ bool SharedLibrary::Load(const char* full_path, has_DT_SYMBOLIC_ = true; break; #if defined(__arm__) - case DT_ANDROID_ARM_REL_OFFSET: + case DT_ANDROID_REL_OFFSET: arm_packed_relocs_offset = dyn.GetOffset(); - LOG(" DT_ANDROID_ARM_REL_OFFSET addr=%p\n", arm_packed_relocs_offset); + LOG(" DT_ANDROID_REL_OFFSET addr=%p\n", arm_packed_relocs_offset); break; - case DT_ANDROID_ARM_REL_SIZE: + case DT_ANDROID_REL_SIZE: arm_packed_relocs_size = dyn.GetValue(); - LOG(" DT_ANDROID_ARM_REL_SIZE=%d\n", arm_packed_relocs_size); + LOG(" DT_ANDROID_REL_SIZE=%d\n", arm_packed_relocs_size); break; #endif #if defined(__mips__) diff --git a/tools/relocation_packer/README.TXT b/tools/relocation_packer/README.TXT index a81170abc0ca..6beb5a97edf3 100644 --- a/tools/relocation_packer/README.TXT +++ b/tools/relocation_packer/README.TXT @@ -31,9 +31,9 @@ Unpacking on the device requires the explicit support of an extended crazy linker. Adds the following new .dynamic tags, used by the crazy linker to find the packed .android.rel.dyn section data: - DT_ANDROID_ARM_REL_OFFSET = DT_LOPROC (Processor specific: 0x70000000) + DT_ANDROID_REL_OFFSET = DT_LOOS (Operating System specific: 0x6000000d) - The offset of .android.rel.dyn data in libchrome..so - DT_ANDROID_ARM_REL_SIZE = DT_LOPROC + 1 (Processor Specific: 0x70000001) + DT_ANDROID_REL_SIZE = DT_LOOS + 1 (Operating System Specific: 0x6000000e) - The size of .android.rel.dyn data in bytes The format of .android.rel.dyn data is: diff --git a/tools/relocation_packer/src/elf_file.cc b/tools/relocation_packer/src/elf_file.cc index 86ddd2567236..0fd0f8918a5e 100644 --- a/tools/relocation_packer/src/elf_file.cc +++ b/tools/relocation_packer/src/elf_file.cc @@ -22,8 +22,8 @@ static const uint32_t kStubIdentifier = 0x4c4c554eu; // Out-of-band dynamic tags used to indicate the offset and size of the // .android.rel.dyn section. -static const ELF::Sword DT_ANDROID_REL_OFFSET = DT_LOPROC; -static const ELF::Sword DT_ANDROID_REL_SIZE = DT_LOPROC + 1; +static const ELF::Sword DT_ANDROID_REL_OFFSET = DT_LOOS; +static const ELF::Sword DT_ANDROID_REL_SIZE = DT_LOOS + 1; // Alignment to preserve, in bytes. This must be at least as large as the // largest d_align and sh_addralign values found in the loaded file. diff --git a/tools/relocation_packer/test_data/elf_file_unittest_relocs_packed.so b/tools/relocation_packer/test_data/elf_file_unittest_relocs_packed.so index 1720e4f098594fe93ea29e918f21553399856e9a..1c4943e1ccb1637d6824fdf0680df3a2d2b282d0 100755 GIT binary patch delta 28 icwXCWx7%*R4L%-T28IN70R{#>AU!#OQDzgrwEzHePX?m^ delta 28 icwXCWx7%*R4L%+Q28IH50R{#}AU!#OQDzgrwEzHePX?&~ -- 2.11.4.GIT