summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Das Mohapatra <vivek@collabora.co.uk>2017-09-13 22:23:39 (GMT)
committerVivek Das Mohapatra <vivek@collabora.co.uk>2017-09-13 22:23:39 (GMT)
commit299220b78c4f9db7c670c4cbb333d5bfcfb8832f (patch)
treedeb7295c52aba34bc247d4cf76730a541fa8ffb4
parent859ea86a6e2e08a0648aa0a9ec7ff9e3c89c15ba (diff)
downloadlibcapsule-299220b78c4f9db7c670c4cbb333d5bfcfb8832f.tar.gz
libcapsule-299220b78c4f9db7c670c4cbb333d5bfcfb8832f.tar.xz
Implement two more x86_64 relocation types
R_X86_64_GLOB_DAT and R_X86_64_64 are now supported.
-rw-r--r--utils/process-pt-dynamic.c99
1 files changed, 92 insertions, 7 deletions
diff --git a/utils/process-pt-dynamic.c b/utils/process-pt-dynamic.c
index 528b4e8..48a4991 100644
--- a/utils/process-pt-dynamic.c
+++ b/utils/process-pt-dynamic.c
@@ -222,6 +222,94 @@ try_relocation (ElfW(Addr) *reloc_addr, const char *name, void *data)
#define DUMP_SLOTINFO(n,x) \
DEBUG(DEBUG_ELF, "%s has slot type %s (%d)", n, #x, x)
+static const char *
+reloc_type_name (int type)
+{
+ switch (type)
+ {
+ case R_X86_64_JUMP_SLOT:
+ return "R_X86_64_JUMP_SLOT";
+ case R_X86_64_NONE:
+ return "R_X86_64_NONE";
+ case R_X86_64_64:
+ return "R_X86_64_64";
+ case R_X86_64_PC32:
+ return "R_X86_64_PC32";
+ case R_X86_64_GOT32:
+ return "R_X86_64_GOT32";
+ case R_X86_64_PLT32:
+ return "R_X86_64_PLT32";
+ case R_X86_64_COPY:
+ return "R_X86_64_COPY";
+ case R_X86_64_GLOB_DAT:
+ return "R_X86_64_GLOB_DAT";
+ case R_X86_64_RELATIVE:
+ return "R_X86_64_RELATIVE";
+ case R_X86_64_GOTPCREL:
+ return "R_X86_64_GOTPCREL";
+ case R_X86_64_32:
+ return "R_X86_64_32";
+ case R_X86_64_32S:
+ return "R_X86_64_32S";
+ case R_X86_64_16:
+ return "R_X86_64_16";
+ case R_X86_64_PC16:
+ return "R_X86_64_PC16";
+ case R_X86_64_8:
+ return "R_X86_64_8";
+ case R_X86_64_PC8:
+ return "R_X86_64_PC8";
+ case R_X86_64_DTPMOD64:
+ return "R_X86_64_DTPMOD64";
+ case R_X86_64_DTPOFF64:
+ return "R_X86_64_DTPOFF64";
+ case R_X86_64_TPOFF64:
+ return "R_X86_64_TPOFF64";
+ case R_X86_64_TLSGD:
+ return "R_X86_64_TLSGD";
+ case R_X86_64_TLSLD:
+ return "R_X86_64_TLSLD";
+ case R_X86_64_DTPOFF32:
+ return "R_X86_64_DTPOFF32";
+ case R_X86_64_GOTTPOFF:
+ return "R_X86_64_GOTTPOFF";
+ case R_X86_64_TPOFF32:
+ return "R_X86_64_TPOFF32";
+ case R_X86_64_PC64:
+ return "R_X86_64_PC64";
+ case R_X86_64_GOTOFF64:
+ return "R_X86_64_GOTOFF64";
+ case R_X86_64_GOTPC32:
+ return "R_X86_64_GOTPC32";
+ case R_X86_64_GOT64:
+ return "R_X86_64_GOT64";
+ case R_X86_64_GOTPCREL64:
+ return "R_X86_64_GOTPCREL64";
+ case R_X86_64_GOTPC64:
+ return "R_X86_64_GOTPC64";
+ case R_X86_64_GOTPLT64:
+ return "R_X86_64_GOTPLT64";
+ case R_X86_64_PLTOFF64:
+ return "R_X86_64_PLTOFF64";
+ case R_X86_64_SIZE32:
+ return "R_X86_64_SIZE32";
+ case R_X86_64_SIZE64:
+ return "R_X86_64_SIZE64";
+ case R_X86_64_GOTPC32_TLSDESC:
+ return "R_X86_64_GOTPC32_TLSDESC";
+ case R_X86_64_TLSDESC_CALL:
+ return "R_X86_64_TLSDESC_CALL";
+ case R_X86_64_TLSDESC:
+ return "R_X86_64_TLSDESC";
+ case R_X86_64_IRELATIVE:
+ return "R_X86_64_IRELATIVE";
+ case R_X86_64_RELATIVE64:
+ return "R_X86_64_RELATIVE64";
+ default:
+ return "UNKNOWN";
+ }
+}
+
int
process_dt_rela (const void *start,
int relasz,
@@ -267,19 +355,19 @@ process_dt_rela (const void *start,
void *slot;
// case R_386_JMP_SLOT: // these are secretly the same:
+ case R_X86_64_GLOB_DAT:
case R_X86_64_JUMP_SLOT:
+ case R_X86_64_64:
slot = addr( base, entry->r_offset, entry->r_addend );
DEBUG( DEBUG_ELF,
- "R_X86_64_JUMP_SLOT: %p ← { offset: %"FMT_ADDR"; addend: %"FMT_SIZE" }",
+ "%s: %p ← { offset: %"FMT_ADDR"; addend: %"FMT_SIZE" }",
+ reloc_type_name( chr ),
slot, entry->r_offset, entry->r_addend );
try_relocation( slot, name, data );
break;
case R_X86_64_NONE:
DUMP_SLOTINFO(name, R_X86_64_NONE);
break;
- case R_X86_64_64:
- DUMP_SLOTINFO(name, R_X86_64_64);
- break;
case R_X86_64_PC32:
DUMP_SLOTINFO(name, R_X86_64_PC32);
break;
@@ -292,9 +380,6 @@ process_dt_rela (const void *start,
case R_X86_64_COPY:
DUMP_SLOTINFO(name, R_X86_64_COPY);
break;
- case R_X86_64_GLOB_DAT:
- DUMP_SLOTINFO(name, R_X86_64_GLOB_DAT);
- break;
case R_X86_64_RELATIVE:
DUMP_SLOTINFO(name, R_X86_64_RELATIVE);
break;