summaryrefslogtreecommitdiff
path: root/compiler/linker
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2018-02-21 13:34:53 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-02-21 13:34:53 +0000
commit8567751dd80a71d73ad0208a43f040e8c0ff753f (patch)
tree599d862869486b9caefb24621f653aa3874053c6 /compiler/linker
parent6356cadc5fb22f0488521d785d8cc31608199bb4 (diff)
parenta310f44da27fd374abe854946d4c81ed8cb38496 (diff)
Merge "Remove the size of oatexec and oatdex dynamic symobls."
Diffstat (limited to 'compiler/linker')
-rw-r--r--compiler/linker/elf_builder.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/linker/elf_builder.h b/compiler/linker/elf_builder.h
index f4fcf49675..9fb4b18c27 100644
--- a/compiler/linker/elf_builder.h
+++ b/compiler/linker/elf_builder.h
@@ -722,8 +722,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);
@@ -761,7 +763,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);