aboutsummaryrefslogtreecommitdiff
path: root/tcc.h
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2016-12-10 17:22:08 +0000
committerThomas Preud'homme <robotux@celest.fr>2016-12-10 18:14:10 +0000
commitfe6453f8f08b5c21a339b3169a837772a9864d62 (patch)
tree8f8efde2a3e1c6e3c8f7099a4c22d47e0f98c3f3 /tcc.h
parentd31226c8738d948e2bb4133b56597fff25169e43 (diff)
downloadtinycc-fe6453f8f08b5c21a339b3169a837772a9864d62.tar.gz
tinycc-fe6453f8f08b5c21a339b3169a837772a9864d62.tar.bz2
Use functions to get relocation info
MSVC does not support array designator so cannot compile source using relocs_info. This commit replace the relocs_info array into a set of functions, each returning the value given by a given field of the struct reloc_info.
Diffstat (limited to 'tcc.h')
-rw-r--r--tcc.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/tcc.h b/tcc.h
index 4f350ff..310134c 100644
--- a/tcc.h
+++ b/tcc.h
@@ -1312,26 +1312,6 @@ 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 known; /* true for known relocation */
- int code_reloc; /* if false, that's a data reloc */
- int gotplt_entry; /* wether and when to create a GOT/PLT entry */
-};
-
-#define INIT_RELOC_INFO(rtype, code_reloc, gotplt_entry) \
- [rtype] = {1, code_reloc, gotplt_entry},
-ST_DATA struct reloc_info relocs_info[R_NUM];
-
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
@@ -1407,6 +1387,20 @@ ST_INLN void inp(void);
ST_FUNC int handle_eob(void);
#endif
+/* ------------ xxx-link.c ------------ */
+
+/* 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) */
+};
+
+ST_FUNC int code_reloc (int reloc_type);
+ST_FUNC int gotplt_entry_type (int reloc_type);
+
/* ------------ xxx-gen.c ------------ */
ST_DATA const int reg_classes[NB_REGS];