diff options
author | 2016-10-03 08:46:48 +0000 | |
---|---|---|
committer | 2016-10-04 17:51:46 +0100 | |
commit | aad75c6d5bfab2dc8e30fc99fafe8cd2dc8b74d8 (patch) | |
tree | c1b9e1eabcf35c5cbb5b4f46313a4e062f2d5d51 /compiler/elf_builder.h | |
parent | 82d4838d6bb3480cd25327cedc5179fb2d86881c (diff) |
Revert "Revert "Store resolved Strings for AOT code in .bss.""
Fixed oat_test to keep dex files alive. Fixed mips build.
Rewritten the .bss GC root visiting and added write barrier
to the artResolveStringFromCode().
Test: build aosp_mips-eng
Test: m ART_DEFAULT_GC_TYPE=SS test-art-target-host-gtest-oat_test
Test: Run ART test suite on host and Nexus 9.
Bug: 20323084
Bug: 30627598
This reverts commit 5f926055cb88089d8ca27243f35a9dfd89d981f0.
Change-Id: I07fa2278d82b8eb64964c9a4b66cb93726ccda6b
Diffstat (limited to 'compiler/elf_builder.h')
-rw-r--r-- | compiler/elf_builder.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/elf_builder.h b/compiler/elf_builder.h index 02831c9dc7..73240bed03 100644 --- a/compiler/elf_builder.h +++ b/compiler/elf_builder.h @@ -619,7 +619,8 @@ class ElfBuilder FINAL { void PrepareDynamicSection(const std::string& elf_file_path, Elf_Word rodata_size, Elf_Word text_size, - Elf_Word bss_size) { + Elf_Word bss_size, + Elf_Word bss_roots_offset) { std::string soname(elf_file_path); size_t directory_separator_pos = soname.rfind('/'); if (directory_separator_pos != std::string::npos) { @@ -659,10 +660,20 @@ class ElfBuilder FINAL { Elf_Word oatlastword_address = rodata_address + rodata_size - 4; dynsym_.Add(oatlastword, rodata_index, oatlastword_address, 4, STB_GLOBAL, STT_OBJECT); } + DCHECK_LE(bss_roots_offset, bss_size); if (bss_size != 0u) { Elf_Word bss_index = rodata_index + 1u + (text_size != 0 ? 1u : 0u); Elf_Word oatbss = dynstr_.Add("oatbss"); - dynsym_.Add(oatbss, bss_index, bss_address, bss_size, STB_GLOBAL, STT_OBJECT); + dynsym_.Add(oatbss, bss_index, bss_address, bss_roots_offset, STB_GLOBAL, STT_OBJECT); + // Add a symbol marking the start of the GC roots part of the .bss, if not empty. + if (bss_roots_offset != bss_size) { + DCHECK_LT(bss_roots_offset, bss_size); + Elf_Word bss_roots_address = bss_address + bss_roots_offset; + Elf_Word bss_roots_size = bss_size - bss_roots_offset; + Elf_Word oatbssroots = dynstr_.Add("oatbssroots"); + dynsym_.Add( + oatbssroots, bss_index, bss_roots_address, bss_roots_size, STB_GLOBAL, STT_OBJECT); + } Elf_Word oatbsslastword = dynstr_.Add("oatbsslastword"); Elf_Word bsslastword_address = bss_address + bss_size - 4; dynsym_.Add(oatbsslastword, bss_index, bsslastword_address, 4, STB_GLOBAL, STT_OBJECT); |