summaryrefslogtreecommitdiff
path: root/compiler/elf_builder.h
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2016-09-21 13:51:10 +0100
committer Vladimir Marko <vmarko@google.com> 2016-09-29 15:58:43 +0100
commit63dccbbefef3014c99c22748d18befcc7bcb3b41 (patch)
tree60a498041bebff43bc1f43d438e3bc34a30887f7 /compiler/elf_builder.h
parent6bee25976782a063d6b44f7718a6302761bf6403 (diff)
Store resolved Strings for AOT code in .bss.
And do some related refactorings. Bug: 20323084 Bug: 30627598 Test: Run ART test suite including gcstress on host and Nexus 9. Test: Run ART test suite including gcstress with baker CC on host and Nexus 9. Test: Build aosp_mips64-eng. Change-Id: I1b12c1570fee8e5da490b47f231050142afcbd1e
Diffstat (limited to 'compiler/elf_builder.h')
-rw-r--r--compiler/elf_builder.h15
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);