1#include <stdio.h>2#include <stdlib.h>34#include <scc/mach.h>5#include <scc/coff32.h>67#include "../libmach.h"8#include "fun.h"910int11coff32new(Obj *obj, int type)12{13 struct arch *p;14 struct coff32 *coff;15 FILHDR *hdr;1617 for (p = coff32archs; p->name && p->type != type; ++p)18 ;19 if (!p->name)20 return -1;2122 if ((coff = calloc(1, sizeof(*coff))) == NULL)23 return -1;2425 hdr = &coff->hdr;26 hdr->f_magic = p->magic[1] << 8 | p->magic[0];27 hdr->f_flags = p->flags;2829 obj->data = coff;30 obj->index = "/";31 return 0;32}