Parse assembler .hidden directive
This makes TCCs assembler understand the '.hidden symbol' directive (and emits a STV_HIDDEN ELF symbol then).
This commit is contained in:
parent
fbda78aefe
commit
a9fda392a0
3 changed files with 12 additions and 4 deletions
3
libtcc.c
3
libtcc.c
|
@ -508,6 +508,9 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section,
|
|||
if (sym->type.t & VT_IMPORT)
|
||||
other |= 4;
|
||||
}
|
||||
#else
|
||||
if (! (sym->type.t & VT_STATIC))
|
||||
other = (sym->type.t & VT_VIS_MASK) >> VT_VIS_SHIFT;
|
||||
#endif
|
||||
if (tcc_state->leading_underscore && can_add_underscore) {
|
||||
buf1[0] = '_';
|
||||
|
|
12
tccasm.c
12
tccasm.c
|
@ -483,6 +483,7 @@ static void asm_parse_directive(TCCState *s1)
|
|||
case TOK_ASM_globl:
|
||||
case TOK_ASM_global:
|
||||
case TOK_ASM_weak:
|
||||
case TOK_ASM_hidden:
|
||||
tok1 = tok;
|
||||
do {
|
||||
Sym *sym;
|
||||
|
@ -493,9 +494,12 @@ static void asm_parse_directive(TCCState *s1)
|
|||
sym = label_push(&s1->asm_labels, tok, 0);
|
||||
sym->type.t = VT_VOID;
|
||||
}
|
||||
sym->type.t &= ~VT_STATIC;
|
||||
if (tok1 != TOK_ASM_hidden)
|
||||
sym->type.t &= ~VT_STATIC;
|
||||
if (tok1 == TOK_ASM_weak)
|
||||
sym->type.t |= VT_WEAK;
|
||||
else if (tok1 == TOK_ASM_hidden)
|
||||
sym->type.t |= STV_HIDDEN << VT_VIS_SHIFT;
|
||||
next();
|
||||
} while (tok == ',');
|
||||
break;
|
||||
|
@ -588,12 +592,12 @@ static void asm_parse_directive(TCCState *s1)
|
|||
tcc_error("label not found: %s", get_tok_str(tok, NULL));
|
||||
}
|
||||
|
||||
next();
|
||||
skip(',');
|
||||
/* XXX .size name,label2-label1 */
|
||||
if (s1->warn_unsupported)
|
||||
tcc_warning("ignoring .size %s,*", get_tok_str(tok, NULL));
|
||||
|
||||
next();
|
||||
skip(',');
|
||||
while (tok != '\n' && tok != CH_EOF) {
|
||||
next();
|
||||
}
|
||||
|
@ -622,7 +626,7 @@ static void asm_parse_directive(TCCState *s1)
|
|||
}
|
||||
|
||||
if (!strcmp(newtype, "function") || !strcmp(newtype, "STT_FUNC")) {
|
||||
sym->type.t = VT_FUNC;
|
||||
sym->type.t = (sym->type.t & ~VT_BTYPE) | VT_FUNC;
|
||||
}
|
||||
else if (s1->warn_unsupported)
|
||||
tcc_warning("change type of '%s' from 0x%x to '%s' ignored",
|
||||
|
|
1
tcctok.h
1
tcctok.h
|
@ -266,6 +266,7 @@
|
|||
DEF_ASM(file)
|
||||
DEF_ASM(globl)
|
||||
DEF_ASM(global)
|
||||
DEF_ASM(hidden)
|
||||
DEF_ASM(ident)
|
||||
DEF_ASM(size)
|
||||
DEF_ASM(type)
|
||||
|
|
Loading…
Reference in a new issue