Whoops, we have our own <elf.h> copy, so I can just as well add the symbol defines for the relocs instead of hard-coding numbers in tccelf.c.
Unified · Split
| @@ -2895,6 +2895,10 @@ typedef Elf32_Addr Elf32_Conflict; · 2894 unmodified lines | ||
| 2895 | 2895 | #define R_X86_64_TLSDESC 36 /* TLS descriptor. */ |
| 2896 | 2896 | #define R_X86_64_IRELATIVE 37 /* Adjust indirectly by program base */ |
| 2897 | 2897 | #define R_X86_64_RELATIVE64 38 /* 64-bit adjust by program base */ |
| 2898 | +#define R_X86_64_GOTPCRELX 41 /* like GOTPCREL, but optionally with | |
| 2899 | + linker optimizations */ | |
| 2900 | +#define R_X86_64_REX_GOTPCRELX 42 /* like GOTPCRELX, but a REX prefix | |
| 2901 | + is present */ | |
| 2898 | 2902 | |
| 2899 | 2903 | #define R_X86_64_NUM 39 |
| 2900 | 2904 | |
| @@ -941,8 +941,8 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) · 940 unmodified lines | ||
| 941 | 941 | write64le(ptr, val - rel->r_addend); |
| 942 | 942 | break; |
| 943 | 943 | case R_X86_64_GOTPCREL: |
| 944 | − case 41 /* R_X86_64_GOTPCRELX */: | |
| 945 | − case 42 /* R_X86_64_REX_GOTPCRELX */: | |
| 944 | + case R_X86_64_GOTPCRELX: | |
| 945 | + case R_X86_64_REX_GOTPCRELX: | |
| 946 | 946 | write32le(ptr, read32le(ptr) + |
| 947 | 947 | (s1->got->sh_addr - addr + |
| 948 | 948 | s1->sym_attrs[sym_index].got_offset - 4)); |
| @@ -1424,8 +1424,8 @@ ST_FUNC void build_got_entries(TCCState *s1) · 475 unmodified lines | ||
| 1424 | 1424 | case R_X86_64_GOT32: |
| 1425 | 1425 | case R_X86_64_GOTTPOFF: |
| 1426 | 1426 | case R_X86_64_GOTPCREL: |
| 1427 | − case 41 /* R_X86_64_GOTPCRELX */: | |
| 1428 | − case 42 /* R_X86_64_REX_GOTPCRELX */: | |
| 1427 | + case R_X86_64_GOTPCRELX: | |
| 1428 | + case R_X86_64_REX_GOTPCRELX: | |
| 1429 | 1429 | case R_X86_64_PLT32: |
| 1430 | 1430 | sym_index = ELFW(R_SYM)(rel->r_info); |
| 1431 | 1431 | sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; |
| @@ -1441,7 +1441,9 @@ ST_FUNC void build_got_entries(TCCState *s1) · 9 unmodified lines | ||
| 1441 | 1441 | sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; |
| 1442 | 1442 | } |
| 1443 | 1443 | if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL || |
| 1444 | − type == R_X86_64_PLT32 || type == 41 || type == 42) { | |
| 1444 | + type == R_X86_64_GOTPCRELX || | |
| 1445 | + type == R_X86_64_REX_GOTPCRELX || | |
| 1446 | + type == R_X86_64_PLT32) { | |
| 1445 | 1447 | unsigned long ofs; |
| 1446 | 1448 | /* look at the symbol got offset. If none, then add one */ |
| 1447 | 1449 | if (type == R_X86_64_PLT32) |
| @@ -1773,8 +1775,8 @@ ST_FUNC void fill_got(TCCState *s1) · 325 unmodified lines | ||
| 1773 | 1775 | switch (ELFW(R_TYPE) (rel->r_info)) { |
| 1774 | 1776 | case R_X86_64_GOT32: |
| 1775 | 1777 | case R_X86_64_GOTPCREL: |
| 1776 | − case 41 /* R_X86_64_GOTPCRELX */: | |
| 1777 | − case 42 /* R_X86_64_REX_GOTPCRELX */: | |
| 1778 | + case R_X86_64_GOTPCRELX: | |
| 1779 | + case R_X86_64_REX_GOTPCRELX: | |
| 1778 | 1780 | case R_X86_64_PLT32: |
| 1779 | 1781 | fill_got_entry(s1, rel); |
| 1780 | 1782 | break; |