shithub: scc

ref: 8f191a4cad7365c97247c822c482e1afda3f5b33
dir: /src/libmach/elf64/elf64.c/

View raw version
#include <stdio.h>

#include <scc/mach.h>

#include "../libmach.h"
#include "elf64.h"

struct objops elf64 = {
	.probe = elf64probe,
	.new = elf64new,
	.read = elf64read,
	.getidx = NULL,
	.setidx = NULL,
	.pc2line = NULL,
	.strip = NULL,
	.del = elf64del,
	.write = NULL,
	.getsym = elf64getsym,
	.getsec = elf64getsec,
	.loadmap = NULL,
};

char *
elf64str(Obj *obj, int n, long stroff)
{
	char *tbl;
	size_t siz;
	struct elf64 *elf;

	elf = obj->data;

	tbl = elf->strtbl[n];
	siz = elf->strsiz[n];

	if (!tbl || siz < stroff)
		return "";
	return &tbl[stroff];
}