the R_X86_64_GOTOFF64 relocation was missing

master
Aron BARATH 2017-05-16 07:03:26 +02:00
parent 28435ec58c
commit 307b7b183d
1 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,7 @@ int code_reloc (int reloc_type)
case R_X86_64_GLOB_DAT: case R_X86_64_GLOB_DAT:
case R_X86_64_COPY: case R_X86_64_COPY:
case R_X86_64_RELATIVE: case R_X86_64_RELATIVE:
case R_X86_64_GOTOFF64:
return 0; return 0;
case R_X86_64_PC32: case R_X86_64_PC32:
@ -84,6 +85,7 @@ int gotplt_entry_type (int reloc_type)
case R_X86_64_GOT64: case R_X86_64_GOT64:
case R_X86_64_GOTPC32: case R_X86_64_GOTPC32:
case R_X86_64_GOTPC64: case R_X86_64_GOTPC64:
case R_X86_64_GOTOFF64:
case R_X86_64_GOTPCREL: case R_X86_64_GOTPCREL:
case R_X86_64_GOTPCRELX: case R_X86_64_GOTPCRELX:
case R_X86_64_REX_GOTPCRELX: case R_X86_64_REX_GOTPCRELX:
@ -281,6 +283,9 @@ void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t
/* we load the got offset */ /* we load the got offset */
add64le(ptr, s1->sym_attrs[sym_index].got_offset); add64le(ptr, s1->sym_attrs[sym_index].got_offset);
break; break;
case R_X86_64_GOTOFF64:
add64le(ptr, val - s1->got->sh_addr);
break;
case R_X86_64_RELATIVE: case R_X86_64_RELATIVE:
/* do nothing */ /* do nothing */
break; break;