summaryrefslogtreecommitdiffstats
path: root/linker
diff options
context:
space:
mode:
authorDimitry Ivanov <dimitry@google.com>2015-01-13 22:31:54 +0000
committerDimitry Ivanov <dimitry@google.com>2015-01-13 22:31:54 +0000
commitd338aac19c91bf06f529364f0d1ca3ba8b98bd13 (patch)
treef8e8d79260fbcf10a9bde2b6c5893c4e751cbd82 /linker
parent265a60a0d285a733d9d98f53672bce668803b434 (diff)
downloadbionic-d338aac19c91bf06f529364f0d1ca3ba8b98bd13.zip
bionic-d338aac19c91bf06f529364f0d1ca3ba8b98bd13.tar.gz
bionic-d338aac19c91bf06f529364f0d1ca3ba8b98bd13.tar.bz2
Revert "Refactoring: use generic reloc constants"
This reverts commit 265a60a0d285a733d9d98f53672bce668803b434. Change-Id: I6d46db0ac03cda44ed1e20f6084a552e0089eb14
Diffstat (limited to 'linker')
-rw-r--r--linker/linker.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 36e5b2e..e0fec0f 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1320,25 +1320,33 @@ int soinfo::relocate(ElfW(Rela)* rela, unsigned count, const soinfo_list_t& glob
*/
switch (type) {
- case R_GENERIC_JUMP_SLOT:
- case R_GENERIC_GLOB_DAT:
- case R_GENERIC_RELATIVE:
- case R_GENERIC_IRELATIVE:
#if defined(__aarch64__)
+ case R_AARCH64_JUMP_SLOT:
+ case R_AARCH64_GLOB_DAT:
case R_AARCH64_ABS64:
case R_AARCH64_ABS32:
case R_AARCH64_ABS16:
-#elif defined(__x86_64__)
- case R_X86_64_32:
- case R_X86_64_64:
- case R_X86_64_PC32:
-#endif
+ case R_AARCH64_RELATIVE:
+ case R_AARCH64_IRELATIVE:
/*
* The sym_addr was initialized to be zero above, or the relocation
* code below does not care about value of sym_addr.
* No need to do anything.
*/
break;
+#elif defined(__x86_64__)
+ case R_X86_64_JUMP_SLOT:
+ case R_X86_64_GLOB_DAT:
+ case R_X86_64_32:
+ case R_X86_64_64:
+ case R_X86_64_RELATIVE:
+ case R_X86_64_IRELATIVE:
+ // No need to do anything.
+ break;
+ case R_X86_64_PC32:
+ sym_addr = reloc;
+ break;
+#endif
default:
DL_ERR("unknown weak reloc type %d @ %p (%zu)", type, rela, idx);
return -1;
@@ -1505,7 +1513,7 @@ int soinfo::relocate(ElfW(Rela)* rela, unsigned count, const soinfo_list_t& glob
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 == 0 ? 0 : sym_addr - reloc) + rela->r_addend;
+ *reinterpret_cast<ElfW(Addr)*>(reloc) = sym_addr + rela->r_addend - reloc;
break;
#endif