aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorgrischka <grischka>2009-11-13 17:14:05 +0100
committergrischka <grischka>2009-11-13 18:04:56 +0100
commit5b113f3ee3bc0f3e476535f39d9c3b4562242976 (patch)
tree765eb5a1a989a31799790667ccc9685136230ae1 /tccgen.c
parentdd70d19267ac343adae7bf15fe15c08fa604e5e1 (diff)
downloadtinycc-5b113f3ee3bc0f3e476535f39d9c3b4562242976.tar.gz
tinycc-5b113f3ee3bc0f3e476535f39d9c3b4562242976.tar.bz2
win32: handle __declspec(dllimport)
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tccgen.c b/tccgen.c
index bb7c4e9..0ced4b6 100644
--- a/tccgen.c
+++ b/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". */