shithub: scc

Download patch

ref: b9ed55ac1a4d3a39fd19953edda18451e9b300f0
parent: 970841705f1d80dcbd2717d42545b10220fad35e
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Feb 3 15:18:16 EST 2018

[as] Remove FRELLOC from flags

It is totally equivalent to FABS.

--- a/as/as.h
+++ b/as/as.h
@@ -11,9 +11,8 @@
 
 	FCOMMON = 1 << 2,
 	FEXTERN = 1 << 3,
-	FUNDEF  = 1 << 4,
+	FDEF  = 1 << 4,
 	FGLOBAL = 1 << 5,
-	FRELOC  = 1 << 6,
 	FABS    = 1 << 7,
 };
 
--- a/as/ins.c
+++ b/as/ins.c
@@ -75,7 +75,7 @@
 	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 @@
 
 	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;
--- a/as/myro.c
+++ b/as/myro.c
@@ -92,7 +92,7 @@
 		flags |= MYROSYM_COMMON;
 	if (sym->flags & FEXTERN)
 		flags |= MYROSYM_EXTERN;
-	if (sym->flags & FUNDEF)
+	if (!(sym->flags & FDEF))
 		flags |= MYROSYM_UNDEF;
 	return flags;
 }
--- a/as/symbol.c
+++ b/as/symbol.c
@@ -64,7 +64,7 @@
 
 	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 @@
 	}
 
 	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;