scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 10f4504a3888a07d7650bf4aaab209df283b46ad
parent 052565e529cb91b36cffc7783eac387367f18d64
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 11 Feb 2024 08:23:14 +0100

as: Don't define lables until end of line

As the label of the line can be used in EQU statements
that modify the value of the label we cannot set the
define flag until the end of the line or we will have
a redefine error.

Diffstat:
Msrc/cmd/as/main.c | 3+++
Msrc/cmd/as/symbol.c | 1-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/cmd/as/main.c b/src/cmd/as/main.c @@ -131,6 +131,9 @@ dopass(char *fname) translate(line.op, line.args); else if (line.args) error("arguments without an opcode"); + + if (linesym) + linesym->flags |= FDEF; } return nerrors == 0; diff --git a/src/cmd/as/symbol.c b/src/cmd/as/symbol.c @@ -106,7 +106,6 @@ deflabel(char *name) error("redefinition of label '%s'", name); if (cursec->flags & SABS) sym->flags |= FABS; - sym->flags |= FDEF; sym->value = cursec->curpc; sym->section = cursec;