scc

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

commit 5b05a845df7237ecc51473cfb9a8f5e4aff7ee3c
parent 03b5aecd77d410af75c8236b09f8d70071b0552d
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  1 Nov 2019 11:46:08 +0100

[ld] Link objects in a list

Objects were not linked, which meant that was impossible to run
over the list of object files. We insert at the end of a list
because it keeps the order in which the objects were discovered
in the command line.

Diffstat:
Msrc/cmd/ld/pass1.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/cmd/ld/pass1.c b/src/cmd/ld/pass1.c @@ -85,6 +85,7 @@ load(FILE *fp, int inlib) Obj *obj; Section sec; Symbol sym; + static Obj *last; if ((t = objtype(fp, NULL)) < 0) { error("bad format"); @@ -116,7 +117,10 @@ load(FILE *fp, int inlib) for ( i = 0; getsym(obj, &i, &sym); i++) newsym(&sym, obj); - /* TODO: link the object */ + obj->next = last; + last = obj; + if (!objhead) + objhead = obj; return;