aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tccasm.c17
-rw-r--r--tests/asmtest.S14
2 files changed, 23 insertions, 8 deletions
diff --git a/tccasm.c b/tccasm.c
index 8c62987..263b0f5 100644
--- a/tccasm.c
+++ b/tccasm.c
@@ -601,8 +601,7 @@ static void asm_parse_directive(TCCState *s1)
case TOK_ASM_type:
{
Sym *sym;
- char newtype[64];
- newtype[0] = 0;
+ const char *newtype;
next();
sym = label_find(tok);
@@ -613,13 +612,15 @@ static void asm_parse_directive(TCCState *s1)
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 (tok == TOK_STR) {
+ newtype = tokc.cstr->data;
+ } else {
+ if (tok == '@' || tok == '%')
+ skip(tok);
+ newtype = get_tok_str(tok, NULL);
+ }
- if (!strcmp(newtype, "function")) {
+ if (!strcmp(newtype, "function") || !strcmp(newtype, "STT_FUNC")) {
sym->type.t = VT_FUNC;
}
else if (s1->warn_unsupported)
diff --git a/tests/asmtest.S b/tests/asmtest.S
index d4d83ad..8ae19d4 100644
--- a/tests/asmtest.S
+++ b/tests/asmtest.S
@@ -592,3 +592,17 @@ int $0x10
#ifdef __ASSEMBLER__ // should be defined, for S files
inc %eax
#endif
+
+ft1: ft2: ft3: ft4: ft5: ft6: ft7: ft8: ft9:
+ xor %eax, %eax
+ ret
+
+.type ft1,STT_FUNC
+.type ft2,@STT_FUNC
+.type ft3,%STT_FUNC
+.type ft4,"STT_FUNC"
+.type ft5,function
+.type ft6,@function
+.type ft7,%function
+.type ft8,"function"
+