| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
dex2oat can already generate unwinding and symbol information which
allows tools to create backtrace of mixed native and Java code.
This is a cherry pick from aosp/master which fixes several issues.
Most notably:
* It enables generation of ELF-64 on 64-bit systems (in dex2oat, C
compilers already produce ELF-64). Libunwind requires ELF-64 on
64-bit systems for backtraces to work.
* It enables loading of ELF files with dlopen. This is required for
libunwind to be able to generate backtrace of current process (i.e.
the process requesting backtrace of itself).
* It adds unit test to test the above (32 vs 64 bit, in-proces vs
out-of-process, application code vs framework code).
* Some other fixes or clean-ups which should not be of much
significance but which are easier to include to make the
important CLs cherry-pick cleanly.
This is squash of the following commits from aosp/master:
7381010 ART: CFI Test
e1bbed2 ART: Blacklist CFI test for non-compiled run-tests
aab9f73 ART: Blacklist CFI test for JIT
4437219 ART: Blacklist CFI test for Heap Poisoning
a3a49fe Switch to using ELF-64 for 64-bit architectures.
297ed22 Write 64-bit address in DWARF if we are on 64-bit architecture.
24981a1 Set correct size of PT_PHDR ELF segment.
1a146bf Link .dynamic to .dynstr
67a0653 Make some parts of ELF more (pointer) aligned.
f50fa82 Enable 64-bit CFI tests.
49e1fab Use dlopen to load oat files.
5dedb80 Add more logging output for dlopen.
aa03870 Find the dlopened file using address rather than file path.
82e73dc Release dummy MemMaps corresponding to dlopen.
5c40961 Test that we can unwind framework code.
020c543 Add more log output to the CFI test.
88da3b0 ART: Fix CFI test wrt/ PIC
a70e5b9 CFI test: kill the other process in native code.
ad5fa8c Support generation of CFI in .debug_frame format.
90688ae Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write.
97dabb7 Fix build breakage in dwarf_test.
388d286 Generate just single ARM mapping symbol.
f898087 Split .oat_patches to multiple sections.
491a7fe Fix build - large frame size of ElfWriterQuick<ElfTypes>::Write (again).
8363c77 Add --generate-debug-info flag and remove the other two flags.
461d72a Generate debug info for core.oat files.
Bug: 21924613
Change-Id: I3f944a08dd2ed1df4d8a807da4fee423fdd35eb7
|
|
|
|
|
|
|
|
|
|
|
| |
The addresses in the search table must be relative to the start
of .eh_frame_hdr which results in yet another pointer type to patch.
I have moved the Patch method back to elf_writer_quick where
it can be specialized to one of the three pointer types.
The .eh_frame_hdr takes around 17% of .eh_frame now.
Change-Id: I4770d1355ded6cdff9489c33380f6b06c4e3f9fe
|
|
|
|
|
|
|
|
|
|
|
| |
There is no need to have multiple symbols for a given address
since libunwind still has to pick only one to print.
Likewise, there is no need to duplicate the CFI.
There is fair number of duplicate methods in the boot image,
so this saves over 20% from those debug sections.
Change-Id: Ib4390150257d009a6303b084076750ce56afed60
|
|
|
|
|
|
|
|
| |
Move .eh_frame to the end together with other debug sections.
This should make it easier to remove it using standard strip tools.
Bug:20556771
Change-Id: I8303ccb053aee50d53fb193819d345c91f1e5b75
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Simplify ElfBuilder by removing duplicated or redundant code.
Many of the repeated code patterns were replaced by just
looping over the list of all sections.
Methods Init() and Write() have been merged into one.
The split between those was rather arbitrary, but it was there
for a reason. It allowed creation of raw sections between
the calls which may have depended on layout decisions done in
Init(), but not in Write() (e.g. knowing of offset of .text).
This has been replaced by more generic solution.
All sections are asked about their size first and complete
file layout is calculated. Then the sections are asked to
write their content (potentially using the layout information).
This should be pure refactoring CL - the compiler should
produce bit for bit identical output as before.
Change-Id: I281d13d469801bd8288b36b360d200d98a3e92d7
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Nest section builder classes within the main builder
class to reduce verbosity caused by templates.
* Move .eh_frame and .eh_frame_hdr section headers earlier
so that the section headers are sorted by file offset.
* Do not emit PT_NULL header if .eh_frame_hdr is missing.
None of these changes should have any material impact.
This CL just prepares ground for the following CL.
Change-Id: I56f9825892adb01d413a18ca10cb5c805cb8cd78
|
|
|
|
|
|
|
| |
Also fixed some lines that were too long, and a few other minor
details.
Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes issue 20125400 - ART: Need .eh_frame_hdr and PT_GNU_EH_FRAME
for libunwind.
.eh_frame_hdr serves two purposes. Firstly, it can optionally contain
binary search table for fast eh_frame lookup. This is important for
C++ exception handling, but we do not need it so we omit it.
Secondly, it contains a relative .eh_frame pointer which makes it
easier for run-time code to locate the .eh_frame section.
libunwind seems to rely on this relative pointer.
Bug: 20125400
Change-Id: I7c1e3f68d914f70781404c508395831a3296a7da
|
|
|
|
|
|
|
|
| |
This resolves old TODO in the code. The first method was never
marked as deduped and only the subsequent copies were recognised.
Therefore the suffix might have been missing in backtraces.
Change-Id: I4882d90f3049f7e196cd38c8987ba02960dab338
|
|
|
|
|
|
|
|
|
|
|
|
| |
Decouple generation of CFI from the rest of debug symbols.
This makes it possible to generate oat with CFI but without
the rest of debug symbols.
This is in line with intention of the .eh_frame section.
The section does not have the .debug_ prefix because it
is considered somewhat different to the rest of debug symbols.
Change-Id: I32816ecd4f30ac4e0dc69d69a4993e349c737f96
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current solution is to hard-code knowledge of DWARF in the linker.
This works for simple use of DWARF, but breaks as soon as I try to do
anything more complex. Making the linker fully support DWARF would be
non-trivial task and would be essentially rewrite. Using .oat_patches
is much easier solution.
Relocating .debug_* sections required extending .oat_patches to support
more sections than just .text. I have encoded each section as
null-terminated section name followed by ULEB128 deltas.
The ULEB128 encoding shrinks .oat_patches for .text by factor of
about 6 with 64-bit compiler, and factor of 3 with 32-bit compiler.
On the other hand, it grows by the extra .oat_patches for DWARF which
were not present before (if debug symbols are included).
Overall, it is still a clear improvement even with the DWARF patches.
Change-Id: I78ffeda0f8a3da03341995a3b5ef15c954e16e9f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is purely for organisation. The DWARF related code
is becoming more complex and I do not want to keep mixing
it with the ElfWriter. The ElfWriter probably should not
be dealing with the fine details of DWARF generation.
I intend to do much more work on DWARF in the future so
this situatuion would only get worse as the code grows.
The code could also use some refactoring and splitting.
However, I have mostly just moved it in this CL.
Change-Id: I6e3401a2b745ddf991b440ad7899ad7d4b921be6
|
|
|
|
| |
Change-Id: I9916abd8db227e7a73a3311294e675be5222a709
|
|
|
|
|
|
| |
Call DexFile::DecodeDebugInfo instead of having a local copy.
Change-Id: I4f94fd56a81fea1a2d10d5a26b9650d6d7ff9448
|
|
|
|
|
|
| |
CFI is necessary for stack unwinding in gdb, lldb, and libunwind.
Change-Id: I1a3480e3a4a99f48bf7e6e63c4e83a80cfee40a2
|
|
|
|
|
|
| |
CFI is necessary for stack unwinding in gdb, lldb, and libunwind.
Change-Id: Ic3b84c9dc91c4bae80e27cda02190f3274e95ae8
|
|
|
|
| |
Change-Id: I12a17a8a1c39ffccaa499c328ebac36e4d74dc4e
|
|
|
|
| |
Change-Id: I38e81868cbebdccec6ecbba40494612f7c1d8092
|
|
|
|
|
|
| |
The instructions do not have to be 4 byte aligned.
Change-Id: I58078a15190b835601094611ed01a599e2d99563
|
|
|
|
|
|
|
| |
Also simplify dex to java mapping and handle mapping
in prologues and epilogues.
Change-Id: I410f06024580f2a8788f2c93fe9bca132805029a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Define a fixed layout for dex cache arrays (type, method,
string and field arrays) for dex caches in the boot image.
This gives those arrays fixed offsets from the boot image
code and allows PC-relative addressing of their elements.
Use the PC-relative load on arm64 for relevant instructions,
i.e. invoke-static, invoke-direct, const-string,
const-class, check-cast and instance-of. This reduces the
arm64 boot.oat on Nexus 9 by 1.1MiB.
This CL provides the infrastructure and shows on the arm64
the gains that we can achieve by having fixed dex cache
arrays' layout. To fully use this for the boot images, we
need to implement the PC-relative addressing for other
architectures. To achieve similar gains for apps, we need
to move the dex cache arrays to a .bss section of the oat
file. These changes will be implemented in subsequent CLs.
(Also remove some compiler_driver.h dependencies to reduce
incremental build times.)
Change-Id: Ib1859fa4452d01d983fd92ae22b611f45a85d69b
|
|
|
|
| |
Change-Id: I779b80b8139d9afdc28373f8c68edff5df7726ce
|
|
|
|
| |
Change-Id: I7867d60afc60f57cdbbfd312f02883854d65c805
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a swap-space and corresponding allocator to transparently
switch native allocations to memory backed by a file.
Bug: 18596910
(cherry picked from commit 62746d8d9c4400e4764f162b22bfb1a32be287a9)
Change-Id: I131448f3907115054a592af73db86d2b9257ea33
|
|
|
|
|
|
|
|
|
| |
Using Clang, this pushes the frame size of the caller across our
limit. Thus forbid inlining. The function is only called once per
compile, impact is insignificant.
Bug: 18738594
Change-Id: I19c3f1168a5104ab508a8dbf9f2a8c035cb97e3c
|
|
|
|
|
|
|
|
|
|
|
| |
Fix associated errors about unused paramenters and implict sign conversions.
For sign conversion this was largely in the area of enums, so add ostream
operators for the effected enums and fix tools/generate-operator-out.py.
Tidy arena allocation code and arena allocated data types, rather than fixing
new and delete operators.
Remove dead code.
Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
|
|
|
|
|
|
|
| |
According to ARM ELF specification, add $t mapping symbol to oat file
to indicate that the compiled method is thumb2 code.
Change-Id: I31e4eeab0b2be7754127cc90ac40b00216b48009
|
|
|
|
|
|
|
|
|
| |
Don't do "if (ptr)". Use const. Use DISALLOW_COPY_AND_ASSIGN. Avoid public
member variables.
Move ValueObject to base and use in ELF builder.
Tidy VectorOutputStream to not use non-const reference arguments.
Change-Id: I2c727c3fc61769c3726de7cfb68b2d6eb4477e53
|
|
|
|
|
|
|
|
|
|
| |
Store the linker patches with each CompiledMethod instead of
keeping them in CompilerDriver. Reorganize oat file creation
to apply the patches as we're writing the method code. Add
framework for platform-specific relative call patches in the
OatWriter. Implement relative call patches for ARM.
Change-Id: Ie2effb3d92b61ac8f356140eba09dc37d62290f8
|
|
|
|
|
|
|
|
|
| |
Refactors some classes in elf_writer_quick.h to elf_builder.h to
be more friendly for re-use. Use this in oatdump to add a symtab
to an oat file.
Bug: 17187621, 17322125
Change-Id: I2333291334fd98bd09cc5717fb83cb18efe3a029
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Several places need to be fixed in OAT debug source map generation
(see comments in https://android-review.googlesource.com/#/c/102610/19/compiler/compiled_method.h):
1. Source Maps are deduplicated in Compiler Driver by implicit conversion
SrcMapElems to bytes. This implies incorrect operator==.
2. SrcMapElem operator < is peculiar, and cannot be applied to
SrcMapElems with negative to_ fields
3. SrcMap.Arrange method is not elegant
The fix is to introduce explicit conversion from SrcMapElem to one
signed 64-bit value, which is used as a base of two new operators < and ==.
They are correct and intuitive. DedupeHashFunc is changed to
explicitly convert array elements to byte, so the explicit type conversion
from SrcMapElem to byte is used.
Minor fix: In Line Table Programs the file index set command is generated
only if the index gets new value.
Change-Id: I5e2c03404a437254fc2db3485b22bfc1799b39b7
Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Fix was commited in "Fix frame size issue with 64-bit"
This reverts commit 7eebd95bddc7c6866ba29010d28b4f8251b43242.
Change-Id: I799b7fcab14ae24471d2f9d6d3a5e5cedd4aa7b8
|
|\ \ \
| |/ /
|/| | |
|
| | |
| | |
| | |
| | | |
Change-Id: Ib2f33dfb79952ba39f2d7e5303a2a2e6c4b0a0f6
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| | |
Build fails on arm64 with error message:
art/compiler/elf_writer_quick.cc:1083:1: error: the frame size of 2016 bytes is larger than 1728 bytes [-Werror=frame-larger-than=]
This reverts commit 45b8f1ab2782d02830c77751f883456de799dfb6.
Change-Id: I61b2e5f27ba4b2b32eacaec51fb5e5ed12fd8066
|
|/
|
|
|
|
| |
Make ElfWriterQuick a template class. No functionality change.
Change-Id: I62b60dc9795c4795027e80f0bee6b54622ea49e9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
Now for host-side x86 & x86_64 ART, we are able to get complete stacktrace with even mixed C/C++ & Java stack frames.
Testing:
1. art/test/run-test --host --gdb [--64] --no-relocate 005
2. In gdb, run 'b art::Class_classForName' which is implementation of a Java native method, then 'r'
3. In gdb, run 'bt'. You should see stack frames down to main()
Change-Id: I2d17e9aa0f6d42d374b5362a15ea35a2fce96302
|
|\ |
|
| |
| |
| |
| |
| |
| | |
This fixes an occasional problem with multiarch use of patchoat.
Change-Id: I80799de36774720bd985704f9b709a8378bb5af5
|
|/
|
|
|
|
|
|
| |
Move eh_frame initialization code and CFI writing code to
elf_writer_quick to remove hard-wired dependencies on specific
Quick-compiler backends.
Change-Id: I27ee8ce7245da33a20c90e0086b8d4fd0a2baf4d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2. Emit CFI in .eh_frame instead of .debug_frame.
With CFI, we can correctly unwind past quick generated code.
Now gdb should unwind to main() for both x86 & x86_64 host-side ART.
Note that it does not work with relocation yet.
Testing:
1. art/test/run-test --host --gdb [--64] --no-relocate 005
2. In gdb, run 'b art_quick_invoke_stub', then 'r', then 'c' a few times
3. In gdb, run 'bt'. You should see stack frames down to main()
Change-Id: I5350d4097dc3d360a60cb17c94f1d02b99bc58bb
|
|
|
|
| |
Change-Id: Icfdd327f4ddf129f0a8607162c09ba271c1d49d9
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added debug symbols to ELF files created by dex2oat using
the quick compiler. Adds two flags --include-debug-symbols and
--no-include-debug-symbols for dex2oat that control the inclusion of these
debug symbols. Debug info is added by default if kIsDebugBuild is true.
Fixed bug where Intel DWARF information would not correctly deal with
deduplicated code the binary.
Changed the portable compiler code path in dex2oat.cc so that symbols
will not be stripped when run with --include-debug-symbols.
Change-Id: Ia2eb2f654dedf0e5e8606f7744e05b8d14155fb1
|
|
|
|
| |
Change-Id: I70a3b6fedae6d290a4f01d4ae8fdd726b8aaa90f
|