scc

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

commit 792da85562d736c1559993c1d0434598a315886c
parent 3e4141d9a22f20504656c4f3a81cf7b638654748
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat,  3 Feb 2018 20:18:16 +0100

[as] Remove FRELLOC from flags

It is totally equivalent to FABS.

Diffstat:
Mas/as.h | 3+--
Mas/ins.c | 6+++---
Mas/myro.c | 2+-
Mas/symbol.c | 10++++------
4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/as/as.h b/as/as.h @@ -11,9 +11,8 @@ enum symflags { FCOMMON = 1 << 2, FEXTERN = 1 << 3, - FUNDEF = 1 << 4, + FDEF = 1 << 4, FGLOBAL = 1 << 5, - FRELOC = 1 << 6, FABS = 1 << 7, }; diff --git a/as/ins.c b/as/ins.c @@ -75,7 +75,7 @@ def(Node **args, int siz) while (np = *args++) { Symbol *sym = np->sym; - if (sym->flags & FRELOC) + if ((sym->flags & FABS) == 0) reloc(sym, 0, siz, siz * 8, 0); emit(tobytes(sym->value, siz, endian), siz); } @@ -131,10 +131,10 @@ symexp(int which, Op *op, Node **args) switch (which) { case EQU: - if (pass == 1 && (sym->flags & FUNDEF) == 0) + if (pass == 1 && (sym->flags & FDEF)) error("redefinition of symbol '%s'", sym->name.buf); sym->value = exp->value; - sym->flags &= ~FUNDEF; + sym->flags |= FDEF; break; case COMMON: sym->flags |= FCOMMON; diff --git a/as/myro.c b/as/myro.c @@ -92,7 +92,7 @@ getsymflags(Symbol *sym) flags |= MYROSYM_COMMON; if (sym->flags & FEXTERN) flags |= MYROSYM_EXTERN; - if (sym->flags & FUNDEF) + if (!(sym->flags & FDEF)) flags |= MYROSYM_UNDEF; return flags; } diff --git a/as/symbol.c b/as/symbol.c @@ -64,7 +64,7 @@ lookup(char *name) sym = xmalloc(sizeof(*sym)); sym->name = newstring(name); - sym->flags = FRELOC | FUNDEF | FNTYPE; + sym->flags = FNTYPE; sym->size = sym->value = 0; sym->section = cursec; sym->hash = *list; @@ -106,13 +106,11 @@ deflabel(char *name) } sym = lookup(name); - if (pass == 1 && (sym->flags & FUNDEF) == 0) + if (pass == 1 && (sym->flags & FDEF)) error("redefinition of label '%s'", name); - if (cursec->flags & SABS) { - sym->flags &= ~FRELOC; + if (cursec->flags & SABS) sym->flags |= FABS; - } - sym->flags &= ~FUNDEF; + sym->flags |= FDEF; sym->value = cursec->curpc; sym->section = cursec;