coff32strip.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
---
coff32strip.c (699B)
---
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 #include <scc/mach.h>
5 #include <scc/coff32.h>
6
7 #include "../libmach.h"
8 #include "fun.h"
9
10 int
11 coff32strip(Obj *obj)
12 {
13 int i;
14 SCNHDR *scn;
15 struct coff32 *coff = obj->data;
16 FILHDR *hdr = &coff->hdr;
17
18 for (i = 0; i < hdr->f_nscns; i++) {
19 scn = &coff->scns[i];
20 scn->s_nrelloc = 0;
21 scn->s_relptr = 0;
22 scn->s_nlnno = 0;
23 scn->s_lnnoptr = 0;
24
25 if (coff->rels)
26 free(coff->rels[i]);
27 if (coff->lines)
28 free(coff->lines[i]);
29 }
30
31 hdr->f_nsyms = 0;
32 hdr->f_symptr = 0;
33 hdr->f_flags |= F_RELFLG | F_LMNO | F_LSYMS;
34
35 free(coff->ents);
36 free(coff->rels);
37 free(coff->lines);
38
39 coff->ents = NULL;
40 coff->rels = NULL;
41 coff->lines = NULL;
42
43 return 0;
44 }