From f843cadb6bc07b3b3de6786233df4592d2d5f60d Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 18 Dec 2016 17:23:33 +0100 Subject: tccgen: nocode_wanted alternatively tccgen.c: remove any 'nocode_wanted' checks, except in - greloca(), disables output elf symbols and relocs - get_reg(), will return just the first suitable reg) - save_regs(), will do nothing Some minor adjustments were made where nocode_wanted is set. xxx-gen.c: disable code output directly where it happens in functions: - g(), output disabled - gjmp(), will do nothing - gtst(), dto. --- tccasm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tccasm.c') diff --git a/tccasm.c b/tccasm.c index 7e9c6e6..ee368f4 100644 --- a/tccasm.c +++ b/tccasm.c @@ -915,8 +915,12 @@ static void asm_parse_directive(TCCState *s1) /* assemble a file */ static int tcc_assemble_internal(TCCState *s1, int do_preprocess) { + int saved_nocode_wanted; int opcode; + saved_nocode_wanted = nocode_wanted; + nocode_wanted = 0; + /* XXX: undefine C labels */ ch = file->buf_ptr[0]; @@ -960,7 +964,7 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess) /* 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) { + if (sym && (sym->type.t & VT_EXTERN) && saved_nocode_wanted) { sym = label_find(opcode); if (!sym) { sym = label_push(&s1->asm_labels, opcode, 0); @@ -989,6 +993,7 @@ static int tcc_assemble_internal(TCCState *s1, int do_preprocess) asm_free_labels(s1); + nocode_wanted = saved_nocode_wanted; return 0; } -- cgit v1.3.1