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