commit 8294c8a407034cd7180d8bdcd921a2b80f532321
parent 5b05a845df7237ecc51473cfb9a8f5e4aff7ee3c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 1 Nov 2019 11:52:19 +0100
[ld] Cleanup section.c
There were some old and dirty code in section.c after the last changes.
Diffstat:
3 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/src/cmd/ld/Makefile b/src/cmd/ld/Makefile
@@ -10,7 +10,7 @@ OBJS =\
section.o\
pass1.o\
pass2.o \
-# pass3.o \
+ pass3.o \
# pass4.o \
# pass5.o \
diff --git a/src/cmd/ld/pass3.c b/src/cmd/ld/pass3.c
@@ -45,7 +45,6 @@ void
pass3(int argc, char *argv[])
{
Obj *obj;
- Objlst *lst;
Objsec *sp;
Segment *seg;
@@ -57,8 +56,7 @@ pass3(int argc, char *argv[])
data.base = rodata.base + rodata.size;
bss.base = data.base + data.size;
- for (lst = objhead; lst; lst = lst->next) {
- obj = lst->obj;
+ for (obj = objhead; obj; obj = obj->next) {
for (sp = obj->secs; sp; sp = sp->next) {
switch (sp->type) {
case 'T':
diff --git a/src/cmd/ld/section.c b/src/cmd/ld/section.c
@@ -26,19 +26,6 @@ struct sectab {
static struct sectab *sectab[NR_SECTION];
static struct sectab secs = {.next = &secs, .prev = &secs};
-static Section *
-linksec(struct sectab *lst, Section *sec)
-{
- struct sectab *sp = (struct sectab *) sec;
-
- sp->next = lst;
- sp->prev = lst->prev;
- lst->prev->next = sp;
- lst->prev = sp;
-
- return sec;
-}
-
Section *
lookupsec(char *name)
{
@@ -70,7 +57,7 @@ lookupsec(char *name)
sec->align = 0;
sec->index = 0;
sec->flags = 0;
- sp->tmpfp;
+ sp->tmpfp = NULL;
sp->hash = sectab[h];
sectab[h] = sp;