diff options
| -rw-r--r-- | tccasm.c | 10 | ||||
| -rw-r--r-- | tests/tests2/85-asm-outside-function.c | 7 | ||||
| -rw-r--r-- | tests/tests2/85-asm-outside-function.expect | 0 |
3 files changed, 17 insertions, 0 deletions
@@ -824,6 +824,16 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess) opcode = tok; next(); if (tok == ':') { + /* handle "extern void vide(void); __asm__("vide: ret");" as + "__asm__("globl vide\nvide: ret");" */ + Sym *sym = sym_find(opcode); + if (sym && (sym->type.t & VT_EXTERN) && nocode_wanted) { + sym = label_find(opcode); + if (!sym) { + sym = label_push(&s1->asm_labels, opcode, 0); + sym->type.t = VT_VOID; + } + } /* new label */ asm_new_label(s1, opcode, 0); next(); diff --git a/tests/tests2/85-asm-outside-function.c b/tests/tests2/85-asm-outside-function.c new file mode 100644 index 0000000..0aa7e33 --- /dev/null +++ b/tests/tests2/85-asm-outside-function.c @@ -0,0 +1,7 @@ +extern void vide(void); +__asm__("vide: ret"); + +int main() { + vide(); + return 0; +} diff --git a/tests/tests2/85-asm-outside-function.expect b/tests/tests2/85-asm-outside-function.expect new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/tests2/85-asm-outside-function.expect |
