aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDetlef Riekenberg <tcc.dev@web.de>2010-04-05 12:31:45 +0200
committerDetlef Riekenberg <tcc.dev@web.de>2010-04-05 12:31:45 +0200
commit6825c5db7204ce7dafba53da03b34e04d4b70a2b (patch)
treeaae9bdf7632e7205dd54b8967ba3f6f2657eb72d
parentf740485a5ab2ecef741bf1161b9feeea9c18cac0 (diff)
downloadtinycc-6825c5db7204ce7dafba53da03b34e04d4b70a2b.tar.gz
tinycc-6825c5db7204ce7dafba53da03b34e04d4b70a2b.tar.bz2
tccasm: Support .type directive (only name,@function)
-- By by ... Detlef
-rw-r--r--tccasm.c31
-rw-r--r--tcctok.h1
2 files changed, 32 insertions, 0 deletions
diff --git a/tccasm.c b/tccasm.c
index a1bd28c..17c4e4b 100644
--- a/tccasm.c
+++ b/tccasm.c
@@ -555,6 +555,37 @@ static void asm_parse_directive(TCCState *s1)
next();
}
break;
+ case TOK_ASM_type:
+ {
+ Sym *sym;
+ char newtype[64];
+ newtype[0] = 0;
+
+ next();
+ sym = label_find(tok);
+ if (!sym) {
+ sym = label_push(&s1->asm_labels, tok, 0);
+ sym->type.t = VT_VOID;
+ }
+
+ next();
+ skip(',');
+ skip('@');
+ if (tok == TOK_STR)
+ pstrcat(newtype, sizeof(newtype), tokc.cstr->data);
+ else
+ pstrcat(newtype, sizeof(newtype), get_tok_str(tok, NULL));
+
+ if (!strcmp(newtype, "function")) {
+ sym->type.t = VT_FUNC;
+ }
+ else if (s1->warn_unsupported)
+ warning("change type of '%s' from 0x%x to '%s' ignored",
+ get_tok_str(sym->v, NULL), sym->type.t, newtype);
+
+ next();
+ }
+ break;
case TOK_SECTION1:
{
char sname[256];
diff --git a/tcctok.h b/tcctok.h
index f512871..8d5d748 100644
--- a/tcctok.h
+++ b/tcctok.h
@@ -252,6 +252,7 @@
DEF_ASM(file)
DEF_ASM(globl)
DEF_ASM(global)
+ DEF_ASM(type)
DEF_ASM(text)
DEF_ASM(data)
DEF_ASM(bss)