shithub: scc

Download patch

ref: f9cdd3f0f5b55988d1895e58458d90622257d2c0
parent: 60bf4e5d8366b38f40e310180c42550d1825d450
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Nov 27 17:32:32 EST 2017

[as] Fix writestrings and writesymbols

Don't emit strings for internal symbols.

--- a/as/myro.c
+++ b/as/myro.c
@@ -20,24 +20,26 @@
 	size_t len;
 	Symbol *sym;
 	Section *sp;
-	String str;
+	String *str;
 
 	fwrite(FORMAT, sizeof(FORMAT), 1, fp);
 	off = sizeof(FORMAT);
 
 	for (sym = symlist; sym; sym = sym->next) {
-		str = sym->name;
-		len = strlen(str.buf) + 1;
-		fwrite(str.buf, len, 1, fp);
-		str.offset = off;
+		if ((sym->flags & TMASK) == TREG)
+			continue;
+		str = &sym->name;
+		len = strlen(str->buf) + 1;
+		fwrite(str->buf, len, 1, fp);
+		str->offset = off;
 		off += len;
 	}
 
 	for (sp = seclist; sp; sp = sp->next) {
-		str = sp->name;
-		len = strlen(str.buf) + 1;
-		fwrite(str.buf, len, 1, fp);
-		str.offset = off;
+		str = &sp->name;
+		len = strlen(str->buf) + 1;
+		fwrite(str->buf, len, 1, fp);
+		str->offset = off;
 		off += len;
 	}
 
@@ -72,6 +74,8 @@
 	struct myrosym symbol;
 
 	for (sym = symlist; sym; sym = sym->next) {
+		if ((sym->flags & TMASK) == TREG)
+			continue;
 		symbol.name = sym->name.offset;
 		symbol.type = -1;
 		symbol.section = -1;