win32: handle __declspec(dllimport)
This commit is contained in:
12
tccgen.c
12
tccgen.c
@ -1100,8 +1100,9 @@ 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].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)) {
|
||||
/* symbol + constant case */
|
||||
if (op == '-')
|
||||
@ -2257,6 +2258,9 @@ static void parse_attribute(AttributeDef *ad)
|
||||
case TOK_DLLEXPORT:
|
||||
FUNC_EXPORT(ad->func_attr) = 1;
|
||||
break;
|
||||
case TOK_DLLIMPORT:
|
||||
FUNC_IMPORT(ad->func_attr) = 1;
|
||||
break;
|
||||
default:
|
||||
if (tcc_state->warn_unsupported)
|
||||
warning("'%s' attribute ignored", get_tok_str(t, NULL));
|
||||
@ -5131,6 +5135,10 @@ static void decl(int l)
|
||||
/* NOTE: as GCC, uninitialized global static
|
||||
arrays of null size are considered as
|
||||
extern */
|
||||
#ifdef TCC_TARGET_PE
|
||||
if (FUNC_IMPORT(ad.func_attr))
|
||||
type.t |= VT_IMPORT;
|
||||
#endif
|
||||
external_sym(v, &type, r);
|
||||
} else {
|
||||
type.t |= (btype.t & VT_STATIC); /* Retain "static". */
|
||||
|
||||
Reference in New Issue
Block a user