shithub: scc

ref: 8d03b46d52b27f48a684587c28e59a79be2aab01
dir: /ld/obj.c/

View raw version
static char sccsid[] = "@(#) ./ld/obj.c";

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "../inc/scc.h"
#include "ld.h"

Obj *objlst;
static Obj *tail;

Obj *
newobj(char *fname, char *member)
{
	Obj *obj;
	char *s, *t;
	size_t l1 = strlen(member), l2 = strlen(fname);

	obj = malloc(sizeof(*obj));
	s = malloc(l1+1);
	t = malloc(l2+1);
	if (!obj || !s || !t)
		outmem();

	obj->fname = memcpy(s, fname, l1);
	obj->member = memcpy(t, member, l2);
	obj->next = NULL;

	if (!objlst)
		tail = objlst = obj;
	else
		tail->next = obj;

	return obj;
}

Symbol *
lookup(char *name)
{
	return NULL;
}