elf64.c (332B)
1 #include <stdio.h> 2 3 #include <scc/mach.h> 4 #include <scc/elf64.h> 5 6 #include "../libmach.h" 7 #include "fun.h" 8 9 char * 10 elf64str(Obj *obj, int n, long stroff) 11 { 12 char *tbl; 13 size_t siz; 14 struct elf64 *elf; 15 16 elf = obj->data; 17 18 tbl = elf->strtbl[n]; 19 siz = elf->strsiz[n]; 20 21 if (!tbl || siz < stroff) 22 return ""; 23 return &tbl[stroff]; 24 }