diff --git a/arm-link.c b/arm-link.c index 207fc61a..51882eab 100644 --- a/arm-link.c +++ b/arm-link.c @@ -41,6 +41,7 @@ int code_reloc (int reloc_type) case R_ARM_GOTPC: case R_ARM_GOTOFF: case R_ARM_GOT32: + case R_ARM_GOT_PREL: case R_ARM_COPY: case R_ARM_GLOB_DAT: case R_ARM_NONE: @@ -93,6 +94,7 @@ int gotplt_entry_type (int reloc_type) return BUILD_GOT_ONLY; case R_ARM_GOT32: + case R_ARM_GOT_PREL: return ALWAYS_GOTPLT_ENTRY; } 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 */ *(int *)ptr += get_sym_attr(s1, sym_index, 0)->got_offset; 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: return; case R_ARM_V4BX: diff --git a/elf.h b/elf.h index b76fe1fa..426108d8 100644 --- a/elf.h +++ b/elf.h @@ -2511,6 +2511,7 @@ typedef Elf32_Addr Elf32_Conflict; #define R_ARM_TLS_CALL 91 #define R_ARM_TLS_DESCSEQ 92 #define R_ARM_THM_TLS_CALL 93 +#define R_ARM_GOT_PREL 96 #define R_ARM_GNU_VTENTRY 100 #define R_ARM_GNU_VTINHERIT 101 #define R_ARM_THM_PC11 102 /* thumb unconditional branch */