-- By by ... Detlef
Unified · Split
| @@ -555,6 +555,37 @@ static void asm_parse_directive(TCCState *s1) · 554 unmodified lines | ||
| 555 | 555 | next(); |
| 556 | 556 | } |
| 557 | 557 | break; |
| 558 | + case TOK_ASM_type: | |
| 559 | + { | |
| 560 | + Sym *sym; | |
| 561 | + char newtype[64]; | |
| 562 | + newtype[0] = 0; | |
| 563 | + | |
| 564 | + next(); | |
| 565 | + sym = label_find(tok); | |
| 566 | + if (!sym) { | |
| 567 | + sym = label_push(&s1->asm_labels, tok, 0); | |
| 568 | + sym->type.t = VT_VOID; | |
| 569 | + } | |
| 570 | + | |
| 571 | + next(); | |
| 572 | + skip(','); | |
| 573 | + skip('@'); | |
| 574 | + if (tok == TOK_STR) | |
| 575 | + pstrcat(newtype, sizeof(newtype), tokc.cstr->data); | |
| 576 | + else | |
| 577 | + pstrcat(newtype, sizeof(newtype), get_tok_str(tok, NULL)); | |
| 578 | + | |
| 579 | + if (!strcmp(newtype, "function")) { | |
| 580 | + sym->type.t = VT_FUNC; | |
| 581 | + } | |
| 582 | + else if (s1->warn_unsupported) | |
| 583 | + warning("change type of '%s' from 0x%x to '%s' ignored", | |
| 584 | + get_tok_str(sym->v, NULL), sym->type.t, newtype); | |
| 585 | + | |
| 586 | + next(); | |
| 587 | + } | |
| 588 | + break; | |
| 558 | 589 | case TOK_SECTION1: |
| 559 | 590 | { |
| 560 | 591 | char sname[256]; |
| @@ -252,6 +252,7 @@ · 251 unmodified lines | ||
| 252 | 252 | DEF_ASM(file) |
| 253 | 253 | DEF_ASM(globl) |
| 254 | 254 | DEF_ASM(global) |
| 255 | + DEF_ASM(type) | |
| 255 | 256 | DEF_ASM(text) |
| 256 | 257 | DEF_ASM(data) |
| 257 | 258 | DEF_ASM(bss) |