tccasm: support .weak labels

master
Joe Soroka 2011-02-01 08:43:54 -08:00
parent 4d5105c8f1
commit c59d3426b8
2 changed files with 5 additions and 0 deletions

1
tcc.h
View File

@ -715,6 +715,7 @@ struct TCCState {
#define DEF_ASM(x) DEF(TOK_ASM_ ## x, #x)
#define TOK_ASM_int TOK_INT
#define TOK_ASM_weak TOK_WEAK1
#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
/* only used for i386 asm opcodes definitions */

View File

@ -481,6 +481,8 @@ static void asm_parse_directive(TCCState *s1)
break;
case TOK_ASM_globl:
case TOK_ASM_global:
case TOK_ASM_weak:
tok1 = tok;
do {
Sym *sym;
@ -491,6 +493,8 @@ static void asm_parse_directive(TCCState *s1)
sym->type.t = VT_VOID;
}
sym->type.t &= ~VT_STATIC;
if (tok1 == TOK_ASM_weak)
sym->type.t |= VT_WEAK;
next();
} while (tok == ',');
break;