diff options
| author | Michael Matz <matz@suse.de> | 2016-08-26 18:11:19 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:11 +0100 |
| commit | 5bd8aeb917ed326f50b1ed45669a1cf40aca75a3 (patch) | |
| tree | eeaf074e00e4944e42a9cc80e8fd5a875e821237 /i386-asm.c | |
| parent | dd57a348664d0fac46a0f4c822f70c80bbf97774 (diff) | |
| download | tinycc-5bd8aeb917ed326f50b1ed45669a1cf40aca75a3.tar.gz tinycc-5bd8aeb917ed326f50b1ed45669a1cf40aca75a3.tar.bz2 | |
tccasm: Support refs to anon symbols from asm
This happens when e.g. string constants (or other static data)
are passed as operands to inline asm as immediates. The produced
symbol ref wouldn't be found. So tighten the connection between
C and asm-local symbol table even more.
Diffstat (limited to 'i386-asm.c')
| -rw-r--r-- | i386-asm.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1437,10 +1437,19 @@ ST_FUNC void subst_asm_operand(CString *add_str, modifier != 'P') cstr_ccat(add_str, '$'); if (r & VT_SYM) { - cstr_cat(add_str, get_tok_str(sv->sym->v, NULL), -1); + const char *name = get_tok_str(sv->sym->v, NULL); + if (sv->sym->v >= SYM_FIRST_ANOM) { + /* In case of anonymuous symbols ("L.42", used + for static data labels) we can't find them + in the C symbol table when later looking up + this name. So enter them now into the asm label + list when we still know the symbol. */ + get_asm_sym(tok_alloc(name, strlen(name))->tok, sv->sym); + } + cstr_cat(add_str, name, -1); if ((uint32_t)sv->c.i == 0) goto no_offset; - cstr_ccat(add_str, '+'); + cstr_ccat(add_str, '+'); } val = sv->c.i; if (modifier == 'n') |
