summaryrefslogtreecommitdiffstats
path: root/runtime/elf_file.h
Commit message (Collapse)AuthorAgeFilesLines
* ART: Do not relocate app program headers in patchoat.Vladimir Marko2015-05-141-1/+1
| | | | | | | | | | | | | | | | Change the check whether to relocate program headers in patchoat to simply look whether there is a PT_LOAD section with p_vaddr == 0. If there is, don't relocate the headers, it should be an app. Otherwise, it's a boot image and needs to be relocated. Add overflow checking to ElfFileImpl<>::GetLoadedSize(). Bug: 21047854 (cherry picked from commit 3fc9903407c6e89ffbbc92ded9e272d9de58e9b6) Change-Id: Ib3e1295fc06993bcfbaadd8f253ee4f5498f52e9
* Simplify template parameters of Elf classes.David Srbecky2015-04-221-7/+3
| | | | | | | | | | | The ELF specification defines several types which differ between 32-bit ELF and 64-bit ELF. We used to template all ELF-related methods on all of those types which was very verbose. This CL wraps all the types as typedefs in ElfTypes32 and ElfTypes64. One of those wrappers is then used as the template parameter. Change-Id: I65247c2c79d92a7c4799e988cf3e4a1b10eb4788
* ART: Fix 64-bit ELF file supportAndreas Gampe2015-04-071-2/+2
| | | | | | | | | | | The API wasn't cross-compile-safe, 32-bit patchoat would fail for negative delta applied to a 64-bit ELF file. Add 64-bit ELF file output to the compilers, behind a flag, currently off by default (preserving current behavior). Bug: 20095017 Change-Id: I2cde7b4c7cc83413c76692d7b745868d644a604c
* ART: Add support for patching and loading OAT files compiled with PICIgor Murashkin2014-10-271-1/+4
| | | | | | | | | | | | * Images (.art) compiled with pic now have a new field added. * isDexOptNeeded will now skip patch-ing for apps compiled PIC * First-boot patching now only copies boot.art, boot.oat is linked As a result, all system preopted dex files (with --compile-pic) no longer take up any space in /data/dalvik-cache/<isa>. Bug: 18035729 Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
* Some code clean-up.Ian Rogers2014-10-161-10/+30
| | | | Change-Id: I4b745fd5298cd61c793e3b57514b48347bd66c0e
* stdint types all the way!Ian Rogers2014-10-091-3/+3
| | | | Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
* ART: Prepare for ELF64.Tong Shen2014-10-031-154/+31
| | | | | | Only expose necessary interface in ElfFile, and move all details into template class ElfFileImpl. Change-Id: I9df2bbc55f32ba0ba91f4f3d5d0009e84a2ddf74
* ART: Make elf loading not abortAndreas Gampe2014-09-151-26/+37
| | | | | | | | | | | | | | Changes elf_file code to use less CHECKs and instead return error values (usually nullptr). This avoids aborts. In oat_file, when loading an oat file fails, try to unlink at. If this succeeds, on the next run we may compile again. Bug: 17491333 (cherry picked from commit afa6b8e93a0dc0de33c9d404945c7c5621e20b1a) Change-Id: I50fdd2edacd86f25d4dacf2180ce2a6105eaf4af
* ART source line debug info in OAT filesYevgeny Rouban2014-08-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OAT files have source line information enough for ART runtime needs like jump to/from interpreter and thread suspension. But this information is not enough for finer grained source level debugging and low-level profiling (VTune or perf). This patch adds to OAT files two additional sections: .debug_line - DWARF formatted Elf32 section with detailed source line information (mapping from native PC to Java source lines). In addition to the debugging symbols added using the dex2oat option --include-debug-symbols, the source line information is added to the section .debug_line. The source line info can be read by many Elf reading tools like objdump, readelf, dwarfdump, gdb, perf, VTune, ... gdb can use this debug line information in x86. In 64-bit mode the information can be used if the oat file is mapped in the lower address space (address has higher 32 bits zeroed). Relocation works. Testing: 1. art/test/run-test --host --gdb [--64] 001-HelloWorld 2. in gdb: break Main.java:19 3. in gdb: break Runtime.java:111 4. in gdb: run - stops at void java.lang.Runtime.<init>() 5. in gdb: backtrace - shows call stack down to main() 6. in gdb: continue - stops at void Main.main() (only in 32-bit mode) 7. in gdb: backtrace - shows call stack down to main() 8. objdump -W <oat-file> - addresses are from VMA range of .text section reported by objdump -h <file> 9. dwarfdump -ka <oat-file> - no errors expected Size of aosp-x86-eng boot.oat increased by 11% from 80.5Mb to 89.2Mb with two sections added .debug_line (7.2Mb) and .rel.debug (1.5Mb). Change-Id: Ib8828832686e49782a63d5529008ff4814ed9cda Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
* Add patchoat tool to Art.Alex Light2014-07-071-0/+1
| | | | | | | | | | | | | 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
* Fixed gdb support and added some ElfFile functionsAlex Light2014-06-271-6/+10
| | | | | | | | | | | | | | | | | | Fixed gdb support so that it would continue working even when debug symbols or other sections are included in the elf file. Also made it actually read parts of the DWARF information so it should work even if there are minor changes to how and where DWARF information is written out. Added a dwarf.h file with the dwarf constants. Added a FindSectionByName function, a FindDynamicSymbol function, and the ability to specify the mmap protection and flags directly if we are mapping in the whole file. Modified elf_writer_quick.cc to use the dwarf constants from dwarf.h. Change-Id: I09e15c425fab252b331a2e4719863552e8b6b137
* Now we have a proper C++ library, use std::unique_ptr.Ian Rogers2014-05-191-2/+2
| | | | | | | Also remove the Android.libcxx.mk and other bits of stlport compatibility mechanics. Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
* Compatibility layer to transition from UniquePtr to std::unique_ptr.Ian Rogers2014-05-151-1/+1
| | | | | | | | | Use ART_WITH_STLPORT (enabled for the target) to cause the use of UniquePtr, for the host switch to std::unique_ptr. For now the type remains called UniquePtr. Make dalvik compile with clang on the host, move its build to C++11. Change-Id: I5ba8d2757904bc089ed62047ea03de3c0853fb12
* Tell GDB about Quick ART generated codeMark Mendell2014-03-021-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is actually a lot of work. To do this, we need: .debug_info .debug_abbrev .debug_frame .debug_str These are generated into the OAT file by OatWriter and ElfWriterQuick. Since the Quick ART runtime doesn't use dlopen to load the OAT files, GDB can't find this information. Use the alternate GDB JIT interface, which can be invoked at runtime. To use this interface, an ELF image needs to be built in memory. Read the information from the OAT file, fixup the addresses to point to the real locations, add a symbol table to hold the .text symbol, and then let GDB know about the information, which will be read from the runtime address space. This is quite primitive now, and could be cleaned up considerably. It probably needs symbol table entries for the methods, and descriptions of parameters and return types. Currently only supported for X86. This defaults to enabled for debug builds. Added dexoat --gen-gdb-info and --no-gen-gdb-info flags to override. Change-Id: I4d18b2370f6dfaa00c8cc1925f10717be3bd1a62 Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
* ElfFile should protect itself from bad inputBrian Carlstrom2014-02-261-50/+54
| | | | | Bug: 13207536 Change-Id: Ia0406a7e8fce4030570503471e003d4da581652f
* Remove dependency on llvm/Support/ELF.h by using linux's elf.h.Nicolas Geoffray2014-02-191-44/+43
| | | | Change-Id: Iefe66af9958641ac7f08fdc22f438d976e5b4d54
* Add missing error message propagation to ElfFile::SetMapBrian Carlstrom2013-11-061-1/+1
| | | | Change-Id: I085e23cd4728e10a7efca3586270c6cffed9e8d4
* Throw IOException at source of failing to open a dex file.Ian Rogers2013-10-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before is: java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) Suppressed: java.lang.ClassNotFoundException: GCBench at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 1 more Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found ... 5 more And after is: java.lang.ClassNotFoundException: Didn't find class "GCBench" on path: DexPathList[[zip file "/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar"],nativeLibraryDirectories=[/disk2/dalvik-dev/out/host/linux-x86/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) Suppressed: java.io.IOException: Zip archive '/disk2/dalvik-dev/out/host/linux-x86/framework/GCBench.jar' doesn't contain classes.dex at dalvik.system.DexFile.openDexFile(Native Method) at dalvik.system.DexFile.<init>(DexFile.java:80) at dalvik.system.DexFile.<init>(DexFile.java:59) at dalvik.system.DexPathList.loadDexFile(DexPathList.java:268) at dalvik.system.DexPathList.makeDexElements(DexPathList.java:235) at dalvik.system.DexPathList.<init>(DexPathList.java:113) at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48) at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:38) at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:128) at java.lang.ClassLoader.access$000(ClassLoader.java:65) at java.lang.ClassLoader$SystemClassLoader.<clinit>(ClassLoader.java:81) at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:137) Suppressed: java.lang.ClassNotFoundException: GCBench at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 1 more Caused by: java.lang.NoClassDefFoundError: Class "LGCBench;" not found ... 5 more Also, move dex file verifier messages out of logs. In the process the ClassLinker::dex_lock_ needed tidying to cover a smaller scope. Bug 11301553. Change-Id: I80058652e11e7ea63457cc01a0cb48afe1c15543
* Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-171-3/+3
| | | | Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
* Do not mark pages executable unnecessarily to play nice with selinuxBrian Carlstrom2013-07-121-2/+3
| | | | Change-Id: Ief4a5da38ac7c2cf7bf6f7a640cb63c5e8ed03bd
* Create separate Android.mk for main build targetsBrian Carlstrom2013-07-121-0/+174
The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81