From a310f44da27fd374abe854946d4c81ed8cb38496 Mon Sep 17 00:00:00 2001 From: David Srbecky Date: Mon, 19 Feb 2018 12:33:36 +0000 Subject: Remove the size of oatexec and oatdex dynamic symobls. We use only the address of them so the size is irrelevant. The current size covers the whole section, which collides with all other symbols which really confuses native tools. Test: m test-art-host-gtest Change-Id: Iad4e3f0ba5dafdf43b3f20f499725c793d35acf6 --- compiler/linker/elf_builder.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'compiler/linker') diff --git a/compiler/linker/elf_builder.h b/compiler/linker/elf_builder.h index 3145497091..e01b8dcd61 100644 --- a/compiler/linker/elf_builder.h +++ b/compiler/linker/elf_builder.h @@ -717,8 +717,10 @@ class ElfBuilder FINAL { Elf_Word oatdata = dynstr_.Add("oatdata"); dynsym_.Add(oatdata, &rodata_, rodata_.GetAddress(), rodata_size, STB_GLOBAL, STT_OBJECT); if (text_size != 0u) { + // The runtime does not care about the size of this symbol (it uses the "lastword" symbol). + // We use size 0 (meaning "unknown size" in ELF) to prevent overlap with the debug symbols. Elf_Word oatexec = dynstr_.Add("oatexec"); - dynsym_.Add(oatexec, &text_, text_.GetAddress(), text_size, STB_GLOBAL, STT_OBJECT); + dynsym_.Add(oatexec, &text_, text_.GetAddress(), /* size */ 0, STB_GLOBAL, STT_OBJECT); Elf_Word oatlastword = dynstr_.Add("oatlastword"); Elf_Word oatlastword_address = text_.GetAddress() + text_size - 4; dynsym_.Add(oatlastword, &text_, oatlastword_address, 4, STB_GLOBAL, STT_OBJECT); @@ -756,7 +758,7 @@ class ElfBuilder FINAL { } if (dex_size != 0u) { Elf_Word oatdex = dynstr_.Add("oatdex"); - dynsym_.Add(oatdex, &dex_, dex_.GetAddress(), dex_size, STB_GLOBAL, STT_OBJECT); + dynsym_.Add(oatdex, &dex_, dex_.GetAddress(), /* size */ 0, STB_GLOBAL, STT_OBJECT); Elf_Word oatdexlastword = dynstr_.Add("oatdexlastword"); Elf_Word oatdexlastword_address = dex_.GetAddress() + dex_size - 4; dynsym_.Add(oatdexlastword, &dex_, oatdexlastword_address, 4, STB_GLOBAL, STT_OBJECT); -- cgit v1.2.3-59-g8ed1b