diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2016-11-12 23:16:07 +0800 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2016-12-03 17:26:51 +0000 |
| commit | 1c811a4d1db56e4ed4fefa99ea39c679aa0c29f0 (patch) | |
| tree | 13775d557fedc7cd4c1922e39fa73ef58a7d0130 /arm64-link.c | |
| parent | 523b55d82d455951659868d68eb54c4f5dbfb5a4 (diff) | |
| download | tinycc-1c811a4d1db56e4ed4fefa99ea39c679aa0c29f0.tar.gz tinycc-1c811a4d1db56e4ed4fefa99ea39c679aa0c29f0.tar.bz2 | |
Make build_got_entries more target independent
Factor most of common logic between targets in build_got_entries by
defining target specific info into structures in the backends.
Diffstat (limited to 'arm64-link.c')
| -rw-r--r-- | arm64-link.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arm64-link.c b/arm64-link.c index 0364ba0..9122eff 100644 --- a/arm64-link.c +++ b/arm64-link.c @@ -1,6 +1,23 @@ #include "tcc.h" #define HAVE_SECTION_RELOC +ST_DATA struct reloc_info relocs_info[] = { + INIT_RELOC_INFO (R_AARCH64_ABS32, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_ABS64, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_MOVW_UABS_G0_NC, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_MOVW_UABS_G1_NC, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_MOVW_UABS_G2_NC, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_MOVW_UABS_G3, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_ADR_PREL_PG_HI21, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_ADD_ABS_LO12_NC, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_JUMP26, 1, AUTO_GOTPLT_ENTRY, 1) + INIT_RELOC_INFO (R_AARCH64_CALL26, 1, AUTO_GOTPLT_ENTRY, 1) + INIT_RELOC_INFO (R_AARCH64_ADR_GOT_PAGE, 0, ALWAYS_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_LD64_GOT_LO12_NC, 0, ALWAYS_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_GLOB_DAT, 0, NO_GOTPLT_ENTRY, 0) + INIT_RELOC_INFO (R_AARCH64_JUMP_SLOT, 1, NO_GOTPLT_ENTRY, 0) +}; + void relocate_init(Section *sr) {} void relocate(TCCState *s1, ElfW_Rel *rel, int type, char *ptr, addr_t addr, addr_t val) @@ -51,7 +68,7 @@ void relocate(TCCState *s1, ElfW_Rel *rel, int type, char *ptr, addr_t addr, add /* This check must match the one in build_got_entries, testing if we really need a PLT slot. */ if (sym->st_shndx == SHN_UNDEF || - s1->output_type == TCC_OUTPUT_MEMORY) + sym->st_shndx == SHN_ABS) /* We've put the PLT slot offset into r_addend when generating it, and that's what we must use as relocation value (adjusted by section offset of course). */ |
