summaryrefslogtreecommitdiff
path: root/masm/reltab.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-10-04 19:41:10 -0400
committerFreya Murphy <freya@freyacat.org>2024-10-04 19:41:10 -0400
commit1c11a13ff33873bcc79d4597d31cd252d5c6c1ae (patch)
treea4321b97f5ad69d1a9b9d06dd629a4dc532758b0 /masm/reltab.c
parentupdate msim usage (diff)
downloadmips-1c11a13ff33873bcc79d4597d31cd252d5c6c1ae.tar.gz
mips-1c11a13ff33873bcc79d4597d31cd252d5c6c1ae.tar.bz2
mips-1c11a13ff33873bcc79d4597d31cd252d5c6c1ae.zip
refactor masm to add codegen step
Diffstat (limited to 'masm/reltab.c')
-rw-r--r--masm/reltab.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/masm/reltab.c b/masm/reltab.c
deleted file mode 100644
index afbd5e7..0000000
--- a/masm/reltab.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <elf.h>
-#include <stdlib.h>
-#include <merror.h>
-
-#include "asm.h"
-
-#define RELTAB_INIT_LEN 8
-
-int reltab_init(struct relocation_table *reltab)
-{
- reltab->size = RELTAB_INIT_LEN;
- reltab->len = 0;
- reltab->data = malloc(sizeof(Elf32_Rela) * RELTAB_INIT_LEN);
-
- if (reltab->data == NULL) {
- PERROR("cannot alloc");
- return M_ERROR;
- }
-
- return M_SUCCESS;
-}
-
-void reltab_free(struct relocation_table *reltab)
-{
- free(reltab->data);
-}
-
-int reltab_push(struct relocation_table *reltab, const Elf32_Rela rel)
-{
- if (reltab->len >= reltab->size) {
- reltab->size *= 2;
- reltab->data = realloc(reltab->data, sizeof(Elf32_Rela)
- * reltab->size);
-
- if (reltab->data == NULL) {
- PERROR("cannot realloc");
- return M_ERROR;
- }
- }
-
- reltab->data[reltab->len++] = rel;
- return M_SUCCESS;
-}