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
508 if (sym->type.t & VT_IMPORT)508 if (sym->type.t & VT_IMPORT)
509 other |= 4;509 other |= 4;
510 }510 }
511#else
512 if (! (sym->type.t & VT_STATIC))
513 other = (sym->type.t & VT_VIS_MASK) >> VT_VIS_SHIFT;
511#endif514#endif
512 if (tcc_state->leading_underscore && can_add_underscore) {515 if (tcc_state->leading_underscore && can_add_underscore) {
513 buf1[0] = '_';516 buf1[0] = '_';
tccasm.c+8−4
@@ -483,6 +483,7 @@ static void asm_parse_directive(TCCState *s1) · 482 unmodified lines
483 case TOK_ASM_globl:483 case TOK_ASM_globl:
484 case TOK_ASM_global:484 case TOK_ASM_global:
485 case TOK_ASM_weak:485 case TOK_ASM_weak:
486 case TOK_ASM_hidden:
486 tok1 = tok;487 tok1 = tok;
487 do { 488 do {
488 Sym *sym;489 Sym *sym;
@@ -493,9 +494,12 @@ static void asm_parse_directive(TCCState *s1) · 4 unmodified lines
493 sym = label_push(&s1->asm_labels, tok, 0);494 sym = label_push(&s1->asm_labels, tok, 0);
494 sym->type.t = VT_VOID;495 sym->type.t = VT_VOID;
495 }496 }
496 sym->type.t &= ~VT_STATIC;497 if (tok1 != TOK_ASM_hidden)
498 sym->type.t &= ~VT_STATIC;
497 if (tok1 == TOK_ASM_weak)499 if (tok1 == TOK_ASM_weak)
498 sym->type.t |= VT_WEAK;500 sym->type.t |= VT_WEAK;
501 else if (tok1 == TOK_ASM_hidden)
502 sym->type.t |= STV_HIDDEN << VT_VIS_SHIFT;
499 next();503 next();
500 } while (tok == ',');504 } while (tok == ',');
501 break;505 break;
@@ -588,12 +592,12 @@ static void asm_parse_directive(TCCState *s1) · 86 unmodified lines
588 tcc_error("label not found: %s", get_tok_str(tok, NULL));592 tcc_error("label not found: %s", get_tok_str(tok, NULL));
589 }593 }
590 594
591 next();
592 skip(',');
593 /* XXX .size name,label2-label1 */595 /* XXX .size name,label2-label1 */
594 if (s1->warn_unsupported)596 if (s1->warn_unsupported)
595 tcc_warning("ignoring .size %s,*", get_tok_str(tok, NULL));597 tcc_warning("ignoring .size %s,*", get_tok_str(tok, NULL));
596 598
599 next();
600 skip(',');
597 while (tok != '\n' && tok != CH_EOF) {601 while (tok != '\n' && tok != CH_EOF) {
598 next();602 next();
599 }603 }
@@ -622,7 +626,7 @@ static void asm_parse_directive(TCCState *s1) · 22 unmodified lines
622 }626 }
623 627
624 if (!strcmp(newtype, "function") || !strcmp(newtype, "STT_FUNC")) {628 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;
626 }630 }
627 else if (s1->warn_unsupported)631 else if (s1->warn_unsupported)
628 tcc_warning("change type of '%s' from 0x%x to '%s' ignored", 632 tcc_warning("change type of '%s' from 0x%x to '%s' ignored",
tcctok.h+1−0
@@ -266,6 +266,7 @@ · 265 unmodified lines
266 DEF_ASM(file)266 DEF_ASM(file)
267 DEF_ASM(globl)267 DEF_ASM(globl)
268 DEF_ASM(global)268 DEF_ASM(global)
269 DEF_ASM(hidden)
269 DEF_ASM(ident)270 DEF_ASM(ident)
270 DEF_ASM(size)271 DEF_ASM(size)
271 DEF_ASM(type)272 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