aboutsummaryrefslogtreecommitdiff
path: root/tccasm.c
diff options
context:
space:
mode:
authorgrischka <grischka>2016-12-18 17:23:33 +0100
committergrischka <grischka>2016-12-18 18:53:21 +0100
commitf843cadb6bc07b3b3de6786233df4592d2d5f60d (patch)
treec11a7c8e9138015eb15dbaffff3bc28708292797 /tccasm.c
parent77d7ea04acb56f839031993c102366e30cad5c25 (diff)
downloadtinycc-f843cadb6bc07b3b3de6786233df4592d2d5f60d.tar.gz
tinycc-f843cadb6bc07b3b3de6786233df4592d2d5f60d.tar.bz2
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.
Diffstat (limited to 'tccasm.c')
-rw-r--r--tccasm.c7
1 files changed, 6 insertions, 1 deletions
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;
}