diff options
author | Junichi Uekawa <uekawa@google.com> | 2015-11-18 10:18:59 +0900 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-06-28 00:54:31 -0700 |
commit | 02972e7101291409121a085b104d3f7451a2e1d7 (patch) | |
tree | a5f7bbb1f4a76a045c6fa15696e34a26df789895 | |
parent | 2a016b8808633cd56962d8024c51941bcd649706 (diff) | |
download | bionic-02972e7101291409121a085b104d3f7451a2e1d7.zip bionic-02972e7101291409121a085b104d3f7451a2e1d7.tar.gz bionic-02972e7101291409121a085b104d3f7451a2e1d7.tar.bz2 |
Do not depend on host bits to get the right size to write.
x86_64 32-bit or 64-bit relocations do not depend on ELF bit size, they
are 32-bit or 64-bit respectively.
Known compiler that emits such code is nacl-clang which emits
R_X86_64_PC32 which should write 32 bits but ended up writing 64 bits.
Change-Id: Ibb6b484c0fea6a7e291362148e8ac749d6674529
-rw-r--r-- | linker/linker.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp index bc40cf1..6019c91 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -2208,14 +2208,14 @@ bool soinfo::relocate(const VersionTracker& version_tracker, ElfRelIteratorT&& r MARK(rel->r_offset); TRACE_TYPE(RELO, "RELO R_X86_64_32 %08zx <- +%08zx %s", static_cast<size_t>(reloc), static_cast<size_t>(sym_addr), sym_name); - *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend; + *reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr + addend; break; case R_X86_64_64: count_relocation(kRelocRelative); MARK(rel->r_offset); TRACE_TYPE(RELO, "RELO R_X86_64_64 %08zx <- +%08zx %s", static_cast<size_t>(reloc), static_cast<size_t>(sym_addr), sym_name); - *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend; + *reinterpret_cast<Elf64_Addr*>(reloc) = sym_addr + addend; break; case R_X86_64_PC32: count_relocation(kRelocRelative); @@ -2223,7 +2223,7 @@ bool soinfo::relocate(const VersionTracker& version_tracker, ElfRelIteratorT&& r TRACE_TYPE(RELO, "RELO R_X86_64_PC32 %08zx <- +%08zx (%08zx - %08zx) %s", static_cast<size_t>(reloc), static_cast<size_t>(sym_addr - reloc), static_cast<size_t>(sym_addr), static_cast<size_t>(reloc), sym_name); - *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + addend - reloc; + *reinterpret_cast<Elf32_Addr*>(reloc) = sym_addr + addend - reloc; break; #elif defined(__arm__) case R_ARM_ABS32: |