commit e8065938a7c02560e8ab8f14d6e3b60774c0ad08
parent c21c4a5a605800e23251b85c8a94a8873b144868
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:
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;