summaryrefslogtreecommitdiffstats
path: root/libebl/i386_symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'libebl/i386_symbol.c')
-rw-r--r--libebl/i386_symbol.c111
1 files changed, 4 insertions, 107 deletions
diff --git a/libebl/i386_symbol.c b/libebl/i386_symbol.c
index e9eded23..dadcc107 100644
--- a/libebl/i386_symbol.c
+++ b/libebl/i386_symbol.c
@@ -21,104 +21,8 @@
#include <stddef.h>
#include <string.h>
-#include <libebl_i386.h>
-
-
-/* Return of the backend. */
-const char *
-i386_backend_name (void)
-{
- return "i386";
-}
-
-
-/* Relocation mapping table. */
-static struct
-{
- const char *name;
- enum { both = 0, rel = 1, exec = 2 } appear;
-} reloc_map_table[] =
- {
- [R_386_NONE] = { "R_386_NONE", both },
- [R_386_32] = { "R_386_32", both },
- [R_386_PC32] = { "R_386_PC32", rel },
- [R_386_GOT32] = { "R_386_GOT32", rel },
- [R_386_PLT32] = { "R_386_PLT32", rel },
- [R_386_COPY] = { "R_386_COPY", exec },
- [R_386_GLOB_DAT] = { "R_386_GLOB_DAT", exec },
- [R_386_JMP_SLOT] = { "R_386_JMP_SLOT", exec },
- [R_386_RELATIVE] = { "R_386_RELATIVE", exec },
- [R_386_GOTOFF] = { "R_386_GOTOFF", rel },
- [R_386_GOTPC] = { "R_386_GOTPC", rel },
- [R_386_32PLT] = { "R_386_32PLT", rel },
- [R_386_TLS_TPOFF] = { "R_386_TLS_TPOFF", rel },
- [R_386_TLS_IE] = { "R_386_TLS_IE", rel },
- [R_386_TLS_GOTIE] = { "R_386_TLS_GOTIE", rel },
- [R_386_TLS_LE] = { "R_386_TLS_LE", rel },
- [R_386_TLS_GD] = { "R_386_TLS_GD", rel },
- [R_386_TLS_LDM] = { "R_386_TLS_LDM", rel },
- [R_386_16] = { "R_386_16", rel },
- [R_386_PC16] = { "R_386_PC16", rel },
- [R_386_8] = { "R_386_8", rel },
- [R_386_PC8] = { "R_386_PC8", rel },
- [R_386_TLS_GD_32] = { "R_386_TLS_GD_32", rel },
- [R_386_TLS_GD_PUSH] = { "R_386_TLS_GD_PUSH", rel },
- [R_386_TLS_GD_CALL] = { "R_386_TLS_GD_CALL", rel },
- [R_386_TLS_GD_POP] = { "R_386_TLS_GD_POP", rel },
- [R_386_TLS_LDM_32] = { "R_386_TLS_LDM_32", rel },
- [R_386_TLS_LDM_PUSH] = { "R_386_TLS_LDM_PUSH", rel },
- [R_386_TLS_LDM_CALL] = { "R_386_TLS_LDM_CALL", rel },
- [R_386_TLS_LDM_POP] = { "R_386_TLS_LDM_POP", rel },
- [R_386_TLS_LDO_32] = { "R_386_TLS_LDO_32", rel },
- [R_386_TLS_IE_32] = { "R_386_TLS_IE_32", rel },
- [R_386_TLS_LE_32] = { "R_386_TLS_LE_32", rel },
- [R_386_TLS_DTPMOD32] = { "R_386_TLS_DTPMOD32", rel },
- [R_386_TLS_DTPOFF32] = { "R_386_TLS_DTPOFF32", rel },
- [R_386_TLS_TPOFF32] = { "R_386_TLS_TPOFF32", rel }
- };
-
-
-/* Determine relocation type string for x86. */
-const char *
-i386_reloc_type_name (int type, char *buf __attribute__ ((unused)),
- size_t len __attribute__ ((unused)))
-{
- if (type < 0 || type >= R_386_NUM)
- return NULL;
-
- return reloc_map_table[type].name;
-}
-
-
-/* Check for correct relocation type. */
-bool
-i386_reloc_type_check (int type)
-{
- return (type >= R_386_NONE && type < R_386_NUM
- && reloc_map_table[type].name != NULL) ? true : false;
-}
-
-
-/* Check for correct relocation type use. */
-bool
-i386_reloc_valid_use (Elf *elf, int type)
-{
- if (type < R_386_NONE || type >= R_386_NUM
- || reloc_map_table[type].name == NULL)
- return false;
-
- Elf32_Ehdr *ehdr = elf32_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 i386_
+#include "libebl_CPU.h"
/* Return true if the symbol type is that referencing the GOT. */
@@ -130,7 +34,7 @@ i386_gotpc_reloc_check (Elf *elf __attribute__ ((unused)), int type)
/* Check for the simple reloc types. */
Elf_Type
-i386_reloc_simple_type (Elf *elf __attribute__ ((unused)), int type)
+i386_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
{
switch (type)
{
@@ -145,7 +49,7 @@ i386_reloc_simple_type (Elf *elf __attribute__ ((unused)), int type)
}
}
-/* Check section name for being that of a debug informatino section. */
+/* Check section name for being that of a debug information section. */
bool (*generic_debugscn_p) (const char *);
bool
i386_debugscn_p (const char *name)
@@ -154,10 +58,3 @@ i386_debugscn_p (const char *name)
|| strcmp (name, ".stab") == 0
|| strcmp (name, ".stabstr") == 0);
}
-
-/* Check whether given relocation is a copy relocation. */
-bool
-i386_copy_reloc_p (int reloc)
-{
- return reloc == R_386_COPY;
-}