[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] reloc problems on arm m1
From: |
Herman ten Brugge |
Subject: |
[Tinycc-devel] reloc problems on arm m1 |
Date: |
Fri, 5 Aug 2022 13:41:23 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 |
I just see a report for reloc problems on apple m1.
The problem is in tccmacho.c. It always genenates x86_64 code:
jmp = section_ptr_add(mo->stubs, 6);
jmp[0] = 0xff; /* jmpq *ofs(%rip) */
jmp[1] = 0x25;
put_elf_reloc(s1->symtab, mo->stubs,
attr->plt_offset + 2,
R_X86_64_GOTPCREL, sym_index);
This should be fixed for arm64.
I have no access to an apply m1 so can not fix this.
Herman
Probably a good start would be:
diff --git a/tccmacho.c b/tccmacho.c
index f9048ea..d644d3e 100644
--- a/tccmacho.c
+++ b/tccmacho.c
@@ -354,12 +354,16 @@ static void check_relocs(TCCState *s1, struct
macho *mo)
if (attr->plt_offset == -1) {
uint8_t *jmp;
attr->plt_offset = mo->stubs->data_offset;
+#ifdef TCC_TARGET_X86_64
jmp = section_ptr_add(mo->stubs, 6);
jmp[0] = 0xff; /* jmpq *ofs(%rip) */
jmp[1] = 0x25;
put_elf_reloc(s1->symtab, mo->stubs,
attr->plt_offset + 2,
R_X86_64_GOTPCREL, sym_index);
+#else
+#error Platform not supported
+#endif
}
rel->r_info = ELFW(R_INFO)(mo->stubsym, type);
rel->r_addend += attr->plt_offset;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Tinycc-devel] reloc problems on arm m1,
Herman ten Brugge <=