elf64.h (1533B)
1 #include <scc/elf/elftypes.h> 2 #include <scc/elf/elfhdr.h> 3 #include <scc/elf/elfphdr.h> 4 #include <scc/elf/elfshdr.h> 5 #include <scc/elf/elfent.h> 6 7 #define ELF_ST_BIND ELF64_ST_BIND 8 #define ELF_ST_TYPE ELF64_ST_TYPE 9 #define Elf_Ehdr Elf64_Ehdr 10 #define Elf_Phdr Elf64_Phdr 11 #define Elf_Shdr Elf64_Shdr 12 #define Elf_Sym Elf64_Sym 13 #define ELFHSZ ELFH64SZ 14 #define ELFPSZ ELFP64SZ 15 #define ELFSSZ ELFS64SZ 16 #define ELFESZ ELFE64SZ 17 18 19 #define SEC_STRTBL 0 20 #define SYM_STRTBL 1 21 22 typedef struct elf64 Elf64; 23 24 struct elf64 { 25 Elf_Ehdr hdr; 26 Elf_Phdr *phdr; 27 Elf_Shdr *shdr; 28 Elf_Shdr *symtab; 29 Elf_Sym *syms; 30 31 char *strtbl[2]; 32 size_t strsiz[2]; 33 34 size_t nsec; 35 size_t nsym; 36 }; 37 38 struct arch { 39 char *name; 40 int mach; 41 int endian; 42 int type; 43 }; 44 45 extern int elf64new(Obj *, int); 46 extern int elf64read(Obj *, FILE *); 47 extern int elf64setidx(long, char **, long *, FILE *); 48 extern int elf64getidx(long *, char ***, long **, FILE *); 49 extern int elf64pc2line(Obj *, unsigned long long , char *, int *); 50 extern int elf64strip(Obj *); 51 extern void elf64del(Obj *); 52 extern int elf64write(Obj *, Map *, FILE *); 53 extern int elf64probe(unsigned char *, char **); 54 extern int elf64type(char *); 55 56 extern int elf64xsetidx(int long , char *[], long [], FILE *); 57 extern int elf64xgetidx(int, long *, char ***, long **, FILE *); 58 59 extern Symbol *elf64getsym(Obj *, int *, Symbol *); 60 extern Section *elf64getsec(Obj *, int *, Section *); 61 extern Map *elf64loadmap(Obj *, FILE *); 62 63 extern char *elf64str(Obj *, int n, long); 64 65 /* globals */ 66 extern struct arch elf64archs[];