From 9e0d23cc47359149a39eafffdbb133963980b6ed Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 27 Nov 2017 04:03:03 +0100 Subject: tccasm: Unify C and asm symbol table This makes the asm symbols use the same members as the C symbols for global decls, e.g. using the ELF symbol to hold offset and section. That allows us to use only one symbol table for C and asm symbols and to get rid of hacks to synch between them. We still need some special handling for symbols that come purely from asm sources. --- tcc.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tcc.h') diff --git a/tcc.h b/tcc.h index 5fc71a5..6241f42 100644 --- a/tcc.h +++ b/tcc.h @@ -356,6 +356,7 @@ extern long double strtold (const char *__nptr, char **__endptr); #endif /* target address type */ #define addr_t ElfW(Addr) +#define ElfSym ElfW(Sym) #if PTR_SIZE == 8 && !defined TCC_TARGET_PE # define LONG_SIZE 8 @@ -383,7 +384,6 @@ typedef struct TokenSym { struct Sym *sym_label; /* direct pointer to label */ struct Sym *sym_struct; /* direct pointer to structure */ struct Sym *sym_identifier; /* direct pointer to identifier */ - struct Sym *sym_asm_label; /* direct pointer to asm label */ int tok; /* token number */ int len; char str[1]; @@ -440,9 +440,8 @@ struct SymAttr { visibility : 2, dllexport : 1, dllimport : 1, - asmcsym : 1, asmexport : 1, - unused : 3; + unused : 4; }; /* function attributes or temporary attributes for parsing */ @@ -799,6 +798,7 @@ struct TCCState { int nb_sym_attrs; /* tiny assembler state */ Sym *asm_labels; + ElfSym esym_dot; #ifdef TCC_TARGET_PE /* PE info */ @@ -1147,7 +1147,7 @@ ST_FUNC Sym *sym_push(int v, CType *type, int r, int c); ST_FUNC void sym_pop(Sym **ptop, Sym *b, int keep); ST_INLN Sym *struct_find(int v); ST_INLN Sym *sym_find(int v); -ST_FUNC Sym *global_identifier_push(int v, int t, int c); +ST_FUNC Sym *global_identifier_push_1(Sym **, int v, int t, int c); ST_FUNC void tcc_open_bf(TCCState *s1, const char *filename, int initlen); ST_FUNC int tcc_open(TCCState *s1, const char *filename); @@ -1316,6 +1316,7 @@ ST_INLN int is_float(int t); ST_FUNC int ieee_finite(double d); ST_FUNC void test_lvalue(void); ST_FUNC void vpushi(int v); +ST_FUNC ElfSym *elfsym(Sym *); ST_FUNC Sym *external_global_sym(int v, CType *type, int r); ST_FUNC void vset(CType *type, int r, int v); ST_FUNC void vswap(void); @@ -1618,6 +1619,8 @@ PUB_FUNC int tcc_get_dllexports(const char *filename, char **pp); # define ST_PE_IMPORT 0x20 # define ST_PE_STDCALL 0x40 #endif +#define ST_ASM_SET 0x04 + /* ------------ tccrun.c ----------------- */ #ifdef TCC_IS_NATIVE #ifdef CONFIG_TCC_STATIC -- cgit v1.3.1