diff options
| author | grischka <grischka> | 2010-01-14 20:55:51 +0100 |
|---|---|---|
| committer | grischka <grischka> | 2010-01-14 20:59:42 +0100 |
| commit | 2341ee5142c184e06964f66696ebf88931953e7d (patch) | |
| tree | 6f858fd311ae47ec4508301e6ebf1df33bd42c8a /tccgen.c | |
| parent | bdb9387a7494d7d5e299cb13bcc94f00215976dd (diff) | |
| download | tinycc-2341ee5142c184e06964f66696ebf88931953e7d.tar.gz tinycc-2341ee5142c184e06964f66696ebf88931953e7d.tar.bz2 | |
tccpe: improve dllimport/export and use for tcc_add_symbol
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 26 |
1 files changed, 10 insertions, 16 deletions
@@ -1343,10 +1343,8 @@ static void gen_opic(int op) } goto general_case; } else if (c2 && (op == '+' || op == '-') && - (((vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == (VT_CONST | VT_SYM) - && !(vtop[-1].sym->type.t & VT_IMPORT)) - || - (vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_LOCAL)) { + (((vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) == (VT_CONST | VT_SYM)) + || (vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_LOCAL)) { /* symbol + constant case */ if (op == '-') l2 = -l2; @@ -2973,7 +2971,7 @@ static void post_type(CType *type, AttributeDef *ad) type_decl(&pt, &ad1, &n, TYPE_DIRECT | TYPE_ABSTRACT); if ((pt.t & VT_BTYPE) == VT_VOID) error("parameter declared as void"); - arg_size += (type_size(&pt, &align) + 3) & ~3; + arg_size += (type_size(&pt, &align) + PTR_SIZE - 1) / PTR_SIZE; } else { old_proto: n = tok; @@ -5284,6 +5282,12 @@ ST_FUNC void decl(int l) func_decl_list(sym); } +#ifdef TCC_TARGET_PE + if (ad.func_import) + type.t |= VT_IMPORT; + if (ad.func_export) + type.t |= VT_EXPORT; +#endif if (tok == '{') { if (l == VT_LOCAL) error("cannot use local functions"); @@ -5402,10 +5406,6 @@ ST_FUNC void decl(int l) /* NOTE: as GCC, uninitialized global static arrays of null size are considered as extern */ -#ifdef TCC_TARGET_PE - if (ad.func_import) - type.t |= VT_IMPORT; -#endif external_sym(v, &type, r); } else { type.t |= (btype.t & VT_STATIC); /* Retain "static". */ @@ -5415,12 +5415,7 @@ ST_FUNC void decl(int l) r |= l; if (has_init) next(); -#ifdef TCC_TARGET_PE - if (ad.func_export) - type.t |= VT_EXPORT; -#endif - decl_initializer_alloc(&type, &ad, r, - has_init, v, l); + decl_initializer_alloc(&type, &ad, r, has_init, v, l); } } if (tok != ',') { @@ -5432,4 +5427,3 @@ ST_FUNC void decl(int l) } } } - |
