shithub: scc

ref: 2d1b151c900071e5362b23e2e673c3cc0221c166
dir: /src/libmach/coff32/coff32loadmap.c/

View raw version
#include <stdio.h>

#include <scc/mach.h>

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

Map *
coff32loadmap(Obj *obj, FILE *fp)
{
	long i;
	Map *map;
	SCNHDR *scn;
	struct coff32 *coff = obj->data;
	FILHDR *hdr = &coff->hdr;
	long nsec = hdr->f_nscns;

	if ((map = newmap(nsec, fp)) == NULL)
		return NULL;

	for (scn = coff->scns; nsec--; ++scn)
		setmap(map, scn->s_name, obj->pos + scn->s_scnptr);

	return map;
}