ref: e12a1007fa3b9df81e20951314a1fc93f0707382
parent: 62b5f13a7e487d4cadb1c82ca7642e34dfcbb512
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Feb 11 11:55:59 EST 2019
[ld] Add moreundef()
--- a/src/cmd/ld/main.c
+++ b/src/cmd/ld/main.c
@@ -90,6 +90,13 @@
remove(output);
}
+static int
+moreundef(void)
+{
+
+ return refhead.next != &refhead;
+}
+
static Symbol *
lookup(char *name, int install)
{
@@ -236,7 +243,7 @@
int t, loaded;
long n;
Objsymdef *def, *dp;
- Symbol *sym, *p;
+ Symbol *sym;
if (getindex(bintype, &n, &def, fp) < 0) {
error("corrupted index");
@@ -243,8 +250,7 @@
return;
}
- p = &refhead;
- for (loaded = 0; p->next != p; loaded = 0) {
+ for (loaded = 0; moreundef(); loaded = 0) {
for (dp = def; dp; dp = dp->next) {
sym = lookup(dp->name, NOINSTALL);
if (!sym || !sym->def)
@@ -382,7 +388,7 @@
fclose(fp);
}
- if (refhead.next != &refhead) {
+ if (moreundef()) {
Symbol *sym, *p;
p = &refhead;