mirror of
https://github.com/frida/tinycc
synced 2024-12-25 14:36:49 +03:00
tccasm: support alternate .type syntaxes
This commit is contained in:
parent
15b8a57096
commit
bec84fa00a
17
tccasm.c
17
tccasm.c
@ -601,8 +601,7 @@ static void asm_parse_directive(TCCState *s1)
|
|||||||
case TOK_ASM_type:
|
case TOK_ASM_type:
|
||||||
{
|
{
|
||||||
Sym *sym;
|
Sym *sym;
|
||||||
char newtype[64];
|
const char *newtype;
|
||||||
newtype[0] = 0;
|
|
||||||
|
|
||||||
next();
|
next();
|
||||||
sym = label_find(tok);
|
sym = label_find(tok);
|
||||||
@ -613,13 +612,15 @@ static void asm_parse_directive(TCCState *s1)
|
|||||||
|
|
||||||
next();
|
next();
|
||||||
skip(',');
|
skip(',');
|
||||||
skip('@');
|
if (tok == TOK_STR) {
|
||||||
if (tok == TOK_STR)
|
newtype = tokc.cstr->data;
|
||||||
pstrcat(newtype, sizeof(newtype), tokc.cstr->data);
|
} else {
|
||||||
else
|
if (tok == '@' || tok == '%')
|
||||||
pstrcat(newtype, sizeof(newtype), get_tok_str(tok, NULL));
|
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;
|
sym->type.t = VT_FUNC;
|
||||||
}
|
}
|
||||||
else if (s1->warn_unsupported)
|
else if (s1->warn_unsupported)
|
||||||
|
@ -592,3 +592,17 @@ int $0x10
|
|||||||
#ifdef __ASSEMBLER__ // should be defined, for S files
|
#ifdef __ASSEMBLER__ // should be defined, for S files
|
||||||
inc %eax
|
inc %eax
|
||||||
#endif
|
#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"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user