summaryrefslogtreecommitdiffstats
path: root/runtime/elf_file.cc
diff options
context:
space:
mode:
authorAlex Light <allight@google.com>2014-06-12 11:26:29 -0700
committerBrian Carlstrom <bdc@google.com>2014-07-07 15:19:58 -0700
commit53cb16b98acf3cf6f3a1e2204ad4958ecf1b5a3c (patch)
treec0129ef3de7148dc6a114449b4f751a560283eb0 /runtime/elf_file.cc
parentae2efea4582df773f80be274bdc754f732b07df3 (diff)
downloadart-53cb16b98acf3cf6f3a1e2204ad4958ecf1b5a3c.zip
art-53cb16b98acf3cf6f3a1e2204ad4958ecf1b5a3c.tar.gz
art-53cb16b98acf3cf6f3a1e2204ad4958ecf1b5a3c.tar.bz2
Add patchoat tool to Art.
Add a new executable called patchoat to art. This tool takes already compiled images and oat files and changes their base address, acting as a cheap form of relocation. Add a --include-patch-information flag to dex2oat and code to add required patch information to oat files created with the quick compiler. Bug: 15358152 Change-Id: Ie0c580db45bb14ec180deb84930def6c3628d97d
Diffstat (limited to 'runtime/elf_file.cc')
-rw-r--r--runtime/elf_file.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc
index bb33978..e5402e1 100644
--- a/runtime/elf_file.cc
+++ b/runtime/elf_file.cc
@@ -724,14 +724,23 @@ Elf32_Dyn& ElfFile::GetDynamic(Elf32_Word i) const {
return *(GetDynamicSectionStart() + i);
}
-Elf32_Word ElfFile::FindDynamicValueByType(Elf32_Sword type) const {
+Elf32_Dyn* ElfFile::FindDynamicByType(Elf32_Sword type) const {
for (Elf32_Word i = 0; i < GetDynamicNum(); i++) {
- Elf32_Dyn& elf_dyn = GetDynamic(i);
- if (elf_dyn.d_tag == type) {
- return elf_dyn.d_un.d_val;
+ Elf32_Dyn* dyn = &GetDynamic(i);
+ if (dyn->d_tag == type) {
+ return dyn;
}
}
- return 0;
+ return NULL;
+}
+
+Elf32_Word ElfFile::FindDynamicValueByType(Elf32_Sword type) const {
+ Elf32_Dyn* dyn = FindDynamicByType(type);
+ if (dyn == NULL) {
+ return 0;
+ } else {
+ return dyn->d_un.d_val;
+ }
}
Elf32_Rel* ElfFile::GetRelSectionStart(Elf32_Shdr& section_header) const {