scc

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

commit dbae0624dd4eebde36d6253a06e61a0d48b44a45
parent 8351c2b171d0d9f0a1746c42254d86160ab15ff1
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 24 Aug 2019 15:19:14 +0100

[libmach] Rework of Objsym structure

The main purpose of this rework is to get rid of Obj prefixed
types and simplify the interface of the library.

Diffstat:
Minclude/scc/scc/mach.h | 7+++++--
Msrc/cmd/ld/pass3.c | 4++--
Msrc/libmach/coff32/coff32read.c | 2+-
3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/scc/scc/mach.h b/include/scc/scc/mach.h @@ -30,10 +30,13 @@ struct objsec { struct objsym { char *name; - int type; - int sec; unsigned long long size; unsigned long long value; + void *aux; + int index; + char class; + char type; + Objsym *next, *hash; }; diff --git a/src/cmd/ld/pass3.c b/src/cmd/ld/pass3.c @@ -22,11 +22,11 @@ rebase(Obj *obj) * we have an error in our code. */ aux = lookup(sym->name); - aux->value += obj->secs[sym->sec].base; + aux->value += obj->secs[sym->index].base; case 't': case 'd': case 'b': - sym->value += obj->secs[sym->sec].base; + sym->value += obj->secs[sym->index].base; case 'U': case 'N': case '?': diff --git a/src/libmach/coff32/coff32read.c b/src/libmach/coff32/coff32read.c @@ -513,7 +513,7 @@ convsyms(Obj *obj) sym->type = t; sym->value = ent->n_value; sym->size = (sym->type == 'C') ? ent->n_value : 0; - sym->sec = ent->n_scnum-1; + sym->index = ent->n_scnum-1; } return i;