scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

coff32strip.c (585B)


      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 
      4 #include <scc/mach.h>
      5 
      6 #include "../libmach.h"
      7 #include "coff32.h"
      8 
      9 void
     10 coff32strip(Obj *obj)
     11 {
     12 	int i;
     13 	FILHDR *hdr;
     14 	SCNHDR *scn;
     15 	struct coff32 *coff = obj->data;
     16 
     17 	hdr = &coff->hdr;
     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 
     26 	hdr->f_nsyms = 0;
     27 	hdr->f_symptr = 0;
     28 	hdr->f_flags |= F_RELFLG | F_LMNO | F_SYMS;
     29 
     30 	free(coff->ents);
     31 	free(coff->rels);
     32 	free(coff->lines);
     33 
     34 	coff->ents = NULL;
     35 	coff->rels = NULL;
     36 	coff->lines = NULL;
     37 }