coff32loadmap.c - scc - simple c99 compiler
(HTM) git clone git://git.simple-cc.org/scc
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
coff32loadmap.c (552B)
---
1 #include <stdio.h>
2
3 #include <scc/mach.h>
4 #include <scc/coff32.h>
5
6 #include "../libmach.h"
7 #include "fun.h"
8
9 Map *
10 coff32loadmap(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;
19
20 nsec = hdr->f_nscns;
21 if ((map = newmap(nsec, 0)) == NULL)
22 return NULL;
23
24 for (i = 0; getsec(obj, &i, &sec); ++i) {
25 sec.offset += obj->pos;
26 src = ((sec.flags & SALLOC) != 0) ? fp : NULL;
27
28 if (mapsec(map, &sec, src, sec.size) < 0)
29 return NULL;
30 }
31
32 return map;
33 }