summaryrefslogtreecommitdiff
path: root/libebl/x86_64_symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'libebl/x86_64_symbol.c')
-rw-r--r--libebl/x86_64_symbol.c97
1 files changed, 3 insertions, 94 deletions
diff --git a/libebl/x86_64_symbol.c b/libebl/x86_64_symbol.c
index 38d357cb..c48af103 100644
--- a/libebl/x86_64_symbol.c
+++ b/libebl/x86_64_symbol.c
@@ -20,96 +20,12 @@
#include <elf.h>
#include <stddef.h>
-#include <libebl_x86_64.h>
-
-
-/* Return of the backend. */
-const char *
-x86_64_backend_name (void)
-{
- return "x86-64";
-}
-
-
-/* Relocation mapping table. */
-static struct
-{
- const char *name;
- enum { both = 0, rel = 1, exec = 2 } appear;
-} reloc_map_table[] =
- {
- [R_X86_64_NONE] = { "R_X86_64_NONE", both },
- [R_X86_64_64] = { "R_X86_64_64", both },
- [R_X86_64_PC32] = { "R_X86_64_PC32", rel },
- [R_X86_64_GOT32] = { "R_X86_64_GOT32", rel },
- [R_X86_64_PLT32] = { "R_X86_64_PLT32", rel },
- [R_X86_64_COPY] = { "R_X86_64_COPY", exec },
- [R_X86_64_GLOB_DAT] = { "R_X86_64_GLOB_DAT", exec },
- [R_X86_64_JUMP_SLOT] = { "R_X86_64_JUMP_SLOT", exec },
- [R_X86_64_RELATIVE] = { "R_X86_64_RELATIVE", exec },
- [R_X86_64_GOTPCREL] = { "R_X86_64_GOTPCREL", exec },
- [R_X86_64_32] = { "R_X86_64_32", both },
- [R_X86_64_32S] = { "R_X86_64_32S", rel },
- [R_X86_64_16] = { "R_X86_64_16", rel },
- [R_X86_64_PC16] = { "R_X86_64_PC16", rel },
- [R_X86_64_8] = { "R_X86_64_8", rel },
- [R_X86_64_PC8] = { "R_X86_64_PC8", rel },
- [R_X86_64_DTPMOD64] = { "R_X86_64_DTPMOD64", rel },
- [R_X86_64_DTPOFF64] = { "R_X86_64_DTPOFF64", rel },
- [R_X86_64_TPOFF64] = { "R_X86_64_TPOFF64", rel },
- [R_X86_64_TLSGD] = { "R_X86_64_TLSGD", rel },
- [R_X86_64_TLSLD] = { "R_X86_64_TLSLD", rel },
- [R_X86_64_DTPOFF32] = { "R_X86_64_DTPOFF32", rel },
- [R_X86_64_GOTTPOFF] = { "R_X86_64_GOTTPOFF", rel },
- [R_X86_64_TPOFF32] = { "R_X86_64_TPOFF32", rel }
- };
-
-
-/* Determine relocation type string for x86-64. */
-const char *
-x86_64_reloc_type_name (int type, char *buf __attribute__ ((unused)),
- size_t len __attribute__ ((unused)))
-{
- if (type < 0 || type >= R_X86_64_NUM)
- return NULL;
-
- return reloc_map_table[type].name;
-}
-
-
-/* Check for correct relocation type. */
-bool
-x86_64_reloc_type_check (int type)
-{
- return (type >= R_X86_64_NONE && type < R_X86_64_NUM
- && reloc_map_table[type].name != NULL) ? true : false;
-}
-
-
-/* Check for correct relocation type use. */
-bool
-x86_64_reloc_valid_use (Elf *elf, int type)
-{
- if (type < R_X86_64_NONE || type >= R_X86_64_NUM
- || reloc_map_table[type].name == NULL)
- return false;
-
- Elf64_Ehdr *ehdr = elf64_getehdr (elf);
- assert (ehdr != NULL);
-
- if (reloc_map_table[type].appear == rel)
- return ehdr->e_type == ET_REL;
-
- if (reloc_map_table[type].appear == exec)
- return ehdr->e_type != ET_REL;
-
- assert (reloc_map_table[type].appear == both);
- return true;
-}
+#define BACKEND x86_64_
+#include "libebl_CPU.h"
/* Check for the simple reloc types. */
Elf_Type
-x86_64_reloc_simple_type (Elf *elf __attribute__ ((unused)), int type)
+x86_64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
{
switch (type)
{
@@ -127,10 +43,3 @@ x86_64_reloc_simple_type (Elf *elf __attribute__ ((unused)), int type)
return ELF_T_NUM;
}
}
-
-/* Check whether given relocation is a copy relocation. */
-bool
-x86_64_copy_reloc_p (int reloc)
-{
- return reloc == R_X86_64_COPY;
-}