summaryrefslogtreecommitdiffstats
path: root/compiler/elf_writer.cc
diff options
context:
space:
mode:
authorTong Shen <endlessroad@google.com>2014-09-03 17:24:56 -0700
committerTong Shen <endlessroad@google.com>2014-10-03 11:25:11 -0700
commit62d1ca3182a6cbb921799825f43ad36821233fd7 (patch)
tree54d9663f5ce10f41e95fe774d4e4841c1a78bbc3 /compiler/elf_writer.cc
parent63462448ca4e377074a10a4720aa22f71154dbe9 (diff)
downloadandroid_art-62d1ca3182a6cbb921799825f43ad36821233fd7.tar.gz
android_art-62d1ca3182a6cbb921799825f43ad36821233fd7.tar.bz2
android_art-62d1ca3182a6cbb921799825f43ad36821233fd7.zip
ART: Prepare for ELF64.
Only expose necessary interface in ElfFile, and move all details into template class ElfFileImpl. Change-Id: I9df2bbc55f32ba0ba91f4f3d5d0009e84a2ddf74
Diffstat (limited to 'compiler/elf_writer.cc')
-rw-r--r--compiler/elf_writer.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/compiler/elf_writer.cc b/compiler/elf_writer.cc
index 55ee18e8d9..47402f38c2 100644
--- a/compiler/elf_writer.cc
+++ b/compiler/elf_writer.cc
@@ -30,8 +30,8 @@
namespace art {
-uint32_t ElfWriter::GetOatDataAddress(ElfFile* elf_file) {
- Elf32_Addr oatdata_address = elf_file->FindSymbolAddress(SHT_DYNSYM,
+uintptr_t ElfWriter::GetOatDataAddress(ElfFile* elf_file) {
+ uintptr_t oatdata_address = elf_file->FindSymbolAddress(SHT_DYNSYM,
"oatdata",
false);
CHECK_NE(0U, oatdata_address);
@@ -51,4 +51,16 @@ void ElfWriter::GetOatElfInformation(File* file,
CHECK_NE(0U, oat_data_offset);
}
+bool ElfWriter::Fixup(File* file, uintptr_t oat_data_begin) {
+ std::string error_msg;
+ std::unique_ptr<ElfFile> elf_file(ElfFile::Open(file, true, false, &error_msg));
+ CHECK(elf_file.get() != nullptr) << error_msg;
+
+ // Lookup "oatdata" symbol address.
+ uintptr_t oatdata_address = ElfWriter::GetOatDataAddress(elf_file.get());
+ uintptr_t base_address = oat_data_begin - oatdata_address;
+
+ return elf_file->Fixup(base_address);
+}
+
} // namespace art