Update bind problem macho

Changed -1 into -2 for plt_offset,
This commit is contained in:
herman ten brugge 2022-12-23 12:17:55 +01:00
parent da0cc61794
commit 03841b6f16

View File

@ -711,7 +711,7 @@ static void check_relocs(TCCState *s1, struct macho *mo)
&& type == R_AARCH64_ADR_GOT_PAGE && type == R_AARCH64_ADR_GOT_PAGE
#endif #endif
) { ) {
attr->plt_offset = -mo->n_bind_rebase - 1; attr->plt_offset = -mo->n_bind_rebase - 2;
bind_rebase_add(mo, 1, s1->got->reloc->sh_info, &save_rel, attr); bind_rebase_add(mo, 1, s1->got->reloc->sh_info, &save_rel, attr);
s1->got->reloc->data_offset -= sizeof (ElfW_Rel); s1->got->reloc->data_offset -= sizeof (ElfW_Rel);
} }
@ -722,7 +722,7 @@ static void check_relocs(TCCState *s1, struct macho *mo)
if (for_code && sym->st_shndx == SHN_UNDEF) { if (for_code && sym->st_shndx == SHN_UNDEF) {
if ((int)attr->plt_offset < -1) { if ((int)attr->plt_offset < -1) {
/* remove above bind and replace with plt */ /* remove above bind and replace with plt */
mo->bind_rebase[-attr->plt_offset - 1].bind = 2; mo->bind_rebase[-attr->plt_offset - 2].bind = 2;
attr->plt_offset = -1; attr->plt_offset = -1;
} }
if (attr->plt_offset == -1) { if (attr->plt_offset == -1) {