Move .oat files to ELF format
Generates .oat in ELF file format using MCLinker
- Uses MCLinker IRBuilder to create a synthetic .o from OatWriter output.
- Uses new ElfFile for prelinking to support art image optimizations.
Adapted OatFile to load using dlopen, ElfFile, or memory, removing raw MemMap mechanism.
Changed image code to not assume oat data will be immediately after
image to allow space for ELF headers.
Passes test-art and works with installd.
Change-Id: Idc026eddb5de93f4b97490c405f3ed7b39589749
diff --git a/src/oatdump.cc b/src/oatdump.cc
index cac89fd..5ee433c 100644
--- a/src/oatdump.cc
+++ b/src/oatdump.cc
@@ -32,6 +32,7 @@
#include "gc/space.h"
#include "image.h"
#include "indenter.h"
+#include "oat.h"
#include "object_utils.h"
#include "os.h"
#include "runtime.h"
@@ -118,7 +119,7 @@
os << StringPrintf("0x%08x\n\n", oat_header.GetImageFileLocationOatChecksum());
os << "IMAGE FILE LOCATION OAT BEGIN:\n";
- os << StringPrintf("0x%08x\n\n", oat_header.GetImageFileLocationOatBegin());
+ os << StringPrintf("0x%08x\n\n", oat_header.GetImageFileLocationOatDataBegin());
os << "IMAGE FILE LOCATION:\n";
const std::string image_file_location(oat_header.GetImageFileLocation());
@@ -218,7 +219,7 @@
// If the last thing in the file is code for a method, there won't be an offset for the "next"
// thing. Instead of having a special case in the upper_bound code, let's just add an entry
// for the end of the file.
- offsets_.insert(static_cast<uint32_t>(oat_file_.End() - oat_file_.Begin()));
+ offsets_.insert(static_cast<uint32_t>(oat_file_.Size()));
}
void AddOffsets(const OatFile::OatMethod& oat_method) {
@@ -696,9 +697,13 @@
os << "OAT CHECKSUM: " << StringPrintf("0x%08x\n\n", image_header_.GetOatChecksum());
- os << "OAT BEGIN:" << reinterpret_cast<void*>(image_header_.GetOatBegin()) << "\n\n";
+ os << "OAT FILE BEGIN:" << reinterpret_cast<void*>(image_header_.GetOatFileBegin()) << "\n\n";
- os << "OAT END:" << reinterpret_cast<void*>(image_header_.GetOatEnd()) << "\n\n";
+ os << "OAT DATA BEGIN:" << reinterpret_cast<void*>(image_header_.GetOatDataBegin()) << "\n\n";
+
+ os << "OAT DATA END:" << reinterpret_cast<void*>(image_header_.GetOatDataEnd()) << "\n\n";
+
+ os << "OAT FILE END:" << reinterpret_cast<void*>(image_header_.GetOatFileEnd()) << "\n\n";
{
os << "ROOTS: " << reinterpret_cast<void*>(image_header_.GetImageRoots()) << "\n";