History

tccasm: Support .type directive (only name,@function)

-- By by ... Detlef

Detlef Riekenberg committed 16 years ago

Commit 6825c5d1 parent f7404852 files · +32 −0Browse files

Unified · Split

2 files
  1. tccasm.c +31 −0
  2. tcctok.h +1 −0
tccasm.c+31−0
@@ -555,6 +555,37 @@ static void asm_parse_directive(TCCState *s1) · 554 unmodified lines
555555 next();
556556 }
557557 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;
558589 case TOK_SECTION1:
559590 {
560591 char sname[256];
tcctok.h+1−0
@@ -252,6 +252,7 @@ · 251 unmodified lines
252252 DEF_ASM(file)
253253 DEF_ASM(globl)
254254 DEF_ASM(global)
255+ DEF_ASM(type)
255256 DEF_ASM(text)
256257 DEF_ASM(data)
257258 DEF_ASM(bss)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t