1#include <stdio.h>23#include <scc/mach.h>4#include <scc/coff32.h>56#include "../libmach.h"7#include "fun.h"89Map *10coff32loadmap(Obj *obj, FILE *fp)11{12 int i, nsec;13 Section sec;14 Map *map;15 FILE *src;16 SCNHDR *scn;17 struct coff32 *coff = obj->data;18 FILHDR *hdr = &coff->hdr;1920 nsec = hdr->f_nscns;21 if ((map = newmap(nsec, 0)) == NULL)22 return NULL;2324 for (i = 0; getsec(obj, &i, &sec); ++i) {25 sec.offset += obj->pos;26 src = ((sec.flags & SALLOC) != 0) ? fp : NULL;2728 if (mapsec(map, &sec, src, sec.size) < 0)29 return NULL;30 }3132 return map;33}