scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <stdio.h>
 2#include <stdlib.h>
 3
 4#include <scc/mach.h>
 5#include <scc/elf.h>
 6
 7#include "../libmach.h"
 8#include "fun.h"
 9
10int
11elfnew(Obj *obj, int type)
12{
13	struct elf *elf;
14	struct arch *ap;
15
16	if ((elf = calloc(1, sizeof(*elf))) == NULL)
17		return -1;
18	for (ap = elfarchs; ap->name; ++ap) {
19		if (ap->type == type)
20			break;
21	}
22
23	elf->is32 = (ap->name) ? ap->is32 : -1;
24	obj->data = elf;
25	obj->index = "/";
26	return 0;
27}