add R_ARM_GOT_PREL for clang

This commit is contained in:
herman ten brugge 2020-12-22 14:31:09 +01:00
parent 9f6b65230a
commit 0352c41a07
2 changed files with 9 additions and 0 deletions

View file

@ -41,6 +41,7 @@ int code_reloc (int reloc_type)
case R_ARM_GOTPC: case R_ARM_GOTPC:
case R_ARM_GOTOFF: case R_ARM_GOTOFF:
case R_ARM_GOT32: case R_ARM_GOT32:
case R_ARM_GOT_PREL:
case R_ARM_COPY: case R_ARM_COPY:
case R_ARM_GLOB_DAT: case R_ARM_GLOB_DAT:
case R_ARM_NONE: case R_ARM_NONE:
@ -93,6 +94,7 @@ int gotplt_entry_type (int reloc_type)
return BUILD_GOT_ONLY; return BUILD_GOT_ONLY;
case R_ARM_GOT32: case R_ARM_GOT32:
case R_ARM_GOT_PREL:
return ALWAYS_GOTPLT_ENTRY; return ALWAYS_GOTPLT_ENTRY;
} }
return -1; return -1;
@ -384,6 +386,12 @@ void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t
/* we load the got offset */ /* we load the got offset */
*(int *)ptr += get_sym_attr(s1, sym_index, 0)->got_offset; *(int *)ptr += get_sym_attr(s1, sym_index, 0)->got_offset;
return; return;
case R_ARM_GOT_PREL:
/* we load the pc relative got offset */
*(int *)ptr += s1->got->sh_addr +
get_sym_attr(s1, sym_index, 0)->got_offset -
addr;
return;
case R_ARM_COPY: case R_ARM_COPY:
return; return;
case R_ARM_V4BX: case R_ARM_V4BX:

1
elf.h
View file

@ -2511,6 +2511,7 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_ARM_TLS_CALL 91 #define R_ARM_TLS_CALL 91
#define R_ARM_TLS_DESCSEQ 92 #define R_ARM_TLS_DESCSEQ 92
#define R_ARM_THM_TLS_CALL 93 #define R_ARM_THM_TLS_CALL 93
#define R_ARM_GOT_PREL 96
#define R_ARM_GNU_VTENTRY 100 #define R_ARM_GNU_VTENTRY 100
#define R_ARM_GNU_VTINHERIT 101 #define R_ARM_GNU_VTINHERIT 101
#define R_ARM_THM_PC11 102 /* thumb unconditional branch */ #define R_ARM_THM_PC11 102 /* thumb unconditional branch */