aboutsummaryrefslogtreecommitdiffhomepage
path: root/obj
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-28 19:02:39 +0100
committerlemon <lsof@mailbox.org>2025-12-28 19:02:39 +0100
commit17b4861e53fd5be2107f3b7fd8bf77f3d2cc15da (patch)
tree019743c333bb6001edd9eb8e639163b6236f24f4 /obj
parent0378ccf92c3c1896af29900039339a077c8b5502 (diff)
backend: start implementing aarch64
Diffstat (limited to 'obj')
-rw-r--r--obj/elf.c11
-rw-r--r--obj/obj.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/obj/elf.c b/obj/elf.c
index 512e710..e39a8d8 100644
--- a/obj/elf.c
+++ b/obj/elf.c
@@ -49,6 +49,7 @@ elfinit(void)
switch (target.arch) {
default: assert(!"arch?");
case ISx86_64: hdr.h32.machine = EM_X86_64; break;
+ case ISaarch64: hdr.h32.machine = EM_ARM64; break;
}
hdr.h32.version = ELFVERSION;
if (targ_64bit) {
@@ -142,6 +143,14 @@ static const ushort relktab[][NRELOCKIND] = {
[REL_PLT32] = 4, /* R_X86_64_PLT32 */
[REL_GOTPCRELX] = 41, /* R_X86_64_GOTPCRELX */
[REL_GOTPCRELX_REX] = 42, /* R_X86_64_REX_GOTPCRELX */
+ },
+ [ISaarch64] = {
+ [REL_ABS64] = 257, /* R_AARCH64_ABS64 */
+ [REL_ABS32] = 258, /* R_AARCH64_ABS32 */
+ [REL_ABS32S] = 258, /* R_AARCH64_ABS32S */
+ [REL_PCREL32] = 261, /* R_AARCH64_PREL2 */
+ [REL_PLT32] = 314, /* R_AARCH64_PLT32 */
+ [REL_CALL26] = 283, /* R_AARCH64_CALL26 */
}
};
@@ -363,7 +372,7 @@ wordalign(struct wbuf *out, int align)
while (off++ & (align - 1)) ioputc(out, 0);
}
-static const bool userelatab[] = { [ISx86_64] = 1 };
+static const bool userelatab[] = { [ISx86_64] = 1, [ISaarch64] = 1 };
void
elffini(struct wbuf *out)
diff --git a/obj/obj.h b/obj/obj.h
index 77da99a..985e583 100644
--- a/obj/obj.h
+++ b/obj/obj.h
@@ -17,6 +17,7 @@ enum relockind {
REL_PLT32,
REL_GOTPCRELX,
REL_GOTPCRELX_REX,
+ REL_CALL26,
NRELOCKIND,
};
enum section { Snone, Stext, Srodata, Sdata, Sbss };