scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 334c5f4eab5fc7f26aafbd0e959832cfcbd2e0a0
parent 9722f089637b867b9f57f04a57c5c592ecc68375
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 27 Nov 2017 22:32:32 +0100

[as] Fix writestrings and writesymbols

Don't emit strings for internal symbols.

Diffstat:
Mas/myro.c | 22+++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/as/myro.c b/as/myro.c @@ -20,24 +20,26 @@ writestrings(FILE *fp) 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 @@ writesymbols(FILE *fp) 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;