History

Parse assembler .hidden directive

This makes TCCs assembler understand the '.hidden symbol' directive (and emits a STV_HIDDEN ELF symbol then).

Michael Matz committed 12 years ago

Commit a9fda391 parent fbda78a3 files · +12 −4Browse files

Unified · Split

3 files
  1. libtcc.c +3 −0
  2. tccasm.c +8 −4
  3. tcctok.h +1 −0
libtcc.c+3−0
@@ -508,6 +508,9 @@ ST_FUNC void put_extern_sym2(Sym *sym, Section *section, · 507 unmodified lines
508508 if (sym->type.t & VT_IMPORT)
509509 other |= 4;
510510 }
511+#else
512+ if (! (sym->type.t & VT_STATIC))
513+ other = (sym->type.t & VT_VIS_MASK) >> VT_VIS_SHIFT;
511514 #endif
512515 if (tcc_state->leading_underscore && can_add_underscore) {
513516 buf1[0] = '_';
tccasm.c+8−4
@@ -483,6 +483,7 @@ static void asm_parse_directive(TCCState *s1) · 482 unmodified lines
483483 case TOK_ASM_globl:
484484 case TOK_ASM_global:
485485 case TOK_ASM_weak:
486+ case TOK_ASM_hidden:
486487 tok1 = tok;
487488 do {
488489 Sym *sym;
@@ -493,9 +494,12 @@ static void asm_parse_directive(TCCState *s1) · 4 unmodified lines
493494 sym = label_push(&s1->asm_labels, tok, 0);
494495 sym->type.t = VT_VOID;
495496 }
496− sym->type.t &= ~VT_STATIC;
497+ if (tok1 != TOK_ASM_hidden)
498+ sym->type.t &= ~VT_STATIC;
497499 if (tok1 == TOK_ASM_weak)
498500 sym->type.t |= VT_WEAK;
501+ else if (tok1 == TOK_ASM_hidden)
502+ sym->type.t |= STV_HIDDEN << VT_VIS_SHIFT;
499503 next();
500504 } while (tok == ',');
501505 break;
@@ -588,12 +592,12 @@ static void asm_parse_directive(TCCState *s1) · 86 unmodified lines
588592 tcc_error("label not found: %s", get_tok_str(tok, NULL));
589593 }
590594
591− next();
592− skip(',');
593595 /* XXX .size name,label2-label1 */
594596 if (s1->warn_unsupported)
595597 tcc_warning("ignoring .size %s,*", get_tok_str(tok, NULL));
596598
599+ next();
600+ skip(',');
597601 while (tok != '\n' && tok != CH_EOF) {
598602 next();
599603 }
@@ -622,7 +626,7 @@ static void asm_parse_directive(TCCState *s1) · 22 unmodified lines
622626 }
623627
624628 if (!strcmp(newtype, "function") || !strcmp(newtype, "STT_FUNC")) {
625− sym->type.t = VT_FUNC;
629+ sym->type.t = (sym->type.t & ~VT_BTYPE) | VT_FUNC;
626630 }
627631 else if (s1->warn_unsupported)
628632 tcc_warning("change type of '%s' from 0x%x to '%s' ignored",
tcctok.h+1−0
@@ -266,6 +266,7 @@ · 265 unmodified lines
266266 DEF_ASM(file)
267267 DEF_ASM(globl)
268268 DEF_ASM(global)
269+ DEF_ASM(hidden)
269270 DEF_ASM(ident)
270271 DEF_ASM(size)
271272 DEF_ASM(type)

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