shithub: scc

ref: f5f5501c8ea833e2e40f4de72b733c4b50fe86dd
dir: /src/libmach/coff32/coff32strip.c/

View raw version
#include <stdio.h>
#include <stdlib.h>

#include <scc/mach.h>

#include "../libmach.h"
#include "coff32.h"

void
coff32strip(Obj *obj)
{
	int i;
	FILHDR *hdr;
	SCNHDR *scn;
	struct coff32 *coff = obj->data;

	hdr = &coff->hdr;
	for (i = 0; i < hdr->f_nscns; i++) {
		scn = &coff->scns[i];
		scn->s_nrelloc = 0;
		scn->s_relptr = 0;
		scn->s_nlnno = 0;
		scn->s_lnnoptr = 0;
	}

	hdr->f_nsyms = 0;
	hdr->f_symptr = 0;
	hdr->f_flags |= F_RELFLG | F_LMNO | F_SYMS;

	free(coff->ents);
	free(coff->rels);
	free(coff->lines);

	coff->ents = NULL;
	coff->rels = NULL;
	coff->lines = NULL;
}