aboutsummaryrefslogtreecommitdiff
path: root/tccasm.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-12-04 03:51:14 +0100
committerMichael Matz <matz@suse.de>2017-12-04 03:51:14 +0100
commitcc6cb7f0e294f0c98c4970c7ec993709fc2daa1a (patch)
treed780f1752a932f06acec05bd1cbdce5a0f48ee04 /tccasm.c
parent529b44c0d53955309e79de3da677973922f48425 (diff)
downloadtinycc-cc6cb7f0e294f0c98c4970c7ec993709fc2daa1a.tar.gz
tinycc-cc6cb7f0e294f0c98c4970c7ec993709fc2daa1a.tar.bz2
Fix another corner case with C/asm symtable
See testcase (from grischka). If the asm has no .globl, but there's a (non-static) C definition the symbol should be exported, even if the first reference comes from asm.
Diffstat (limited to 'tccasm.c')
-rw-r--r--tccasm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tccasm.c b/tccasm.c
index ba76c17..15f1e43 100644
--- a/tccasm.c
+++ b/tccasm.c
@@ -422,9 +422,10 @@ ST_FUNC void asm_free_labels(TCCState *st)
for(s = st->asm_labels; s != NULL; s = s1) {
ElfSym *esym = elfsym(s);
s1 = s->prev;
- /* Possibly update binding and visibility from asm directives. */
+ /* Possibly update binding and visibility from asm directives
+ if the symbol has no C decl (type is VT_VOID).*/
s->type.t &= ~VT_EXTERN;
- if (esym) {
+ if (esym && s->type.t == VT_VOID) {
if (!s->a.asmexport && esym->st_shndx != SHN_UNDEF)
s->type.t |= VT_STATIC;
if (s->a.visibility)