scc

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

coff32strip.c (590B)


      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 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 
     25 	hdr->f_nsyms = 0;
     26 	hdr->f_symptr = 0;
     27 	hdr->f_flags |= F_RELFLG | F_LMNO | F_SYMS;
     28 
     29 	free(coff->ents);
     30 	free(coff->rels);
     31 	free(coff->lines);
     32 
     33 	coff->ents = NULL;
     34 	coff->rels = NULL;
     35 	coff->lines = NULL;
     36 
     37 	return 0;
     38 }