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 /tcc.h | |
| 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 'tcc.h')
| -rw-r--r-- | tcc.h | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -1305,6 +1305,26 @@ typedef struct { unsigned int n_value; /* value of symbol */ } Stab_Sym; +/* Wether to generate a GOT/PLT entry and when. NO_GOTPLT_ENTRY is first so + that unknown relocation don't create a GOT or PLT entry */ +enum gotplt_entry { + NO_GOTPLT_ENTRY, /* never generate (eg. GLOB_DAT & JMP_SLOT relocs) */ + BUILD_GOT_ONLY, /* only build GOT (eg. TPOFF relocs) */ + AUTO_GOTPLT_ENTRY, /* generate if sym is UNDEF */ + ALWAYS_GOTPLT_ENTRY /* always generate (eg. PLTOFF relocs) */ +}; + +/* what kind of relocation is it */ +struct reloc_info { + int code_reloc; /* if false, that's a data reloc */ + int gotplt_entry; /* wether and when to create a GOT/PLT entry */ + int pltoff_addend; /* wether to store the PLT offset in addend */ +}; + +#define INIT_RELOC_INFO(rtype, code_reloc, gotplt_entry, pltoff_addend) \ + [rtype] = {code_reloc, gotplt_entry, pltoff_addend}, +ST_DATA struct reloc_info relocs_info[]; + ST_DATA Section *text_section, *data_section, *bss_section; /* predefined sections */ ST_DATA Section *cur_text_section; /* current section where function code is generated */ #ifdef CONFIG_TCC_ASM |
