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 (685B)
       ---
            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_LSYMS;
           28 
           29         for (i = 0; i < coff->hdr.f_nscns; i++) {
           30                 free(coff->rels[i]);
           31                 free(coff->lines[i]);
           32         }
           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 }