History log of /art/compiler/elf_writer_debug.h
Revision Date Author Comments
a26cb57f46fd3f27a930d9d688fe8670c1f24754 23-Apr-2015 David Srbecky <dsrbecky@google.com> ART stack unwinding fixes for libunwind/gdb/lldb.

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
033d745bb9412c9b546d29395cc9efbbb4fa306e 30-Apr-2015 David Srbecky <dsrbecky@google.com> Add binary search table to .eh_frame_hdr

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
527c9c71f0c6e2f9943ac028e7c050500699a44b 17-Apr-2015 David Srbecky <dsrbecky@google.com> Generate .eh_frame_hdr section and PT_GNU_EH_FRAME segment.

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
8dc7324da5bd0f2afd2ab558ab04882329a61fe8 12-Apr-2015 David Srbecky <dsrbecky@google.com> Add --include-cfi compiler option.

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
2f6cdb01f74772c1c521a125776ef57ea3c73d43 11-Apr-2015 David Srbecky <dsrbecky@google.com> Relocate DWARF using .oat_patches.

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
3b9d57ab580a0593635a7dbe3dd2e2c76274f9fa 10-Apr-2015 David Srbecky <dsrbecky@google.com> Move DWARF related code in ElfWriter to its own file.

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