| 18 | import java.io.IOException; |
| 19 | |
| 20 | public interface Elf { |
| 21 | abstract class Header { |
| 22 | public static final int ELFCLASS32 = 1; // 32 Bit ELF |
| 23 | public static final int ELFCLASS64 = 2; // 64 Bit ELF |
| 24 | public static final int ELFDATA2MSB = 2; // Big Endian, 2s complement |
| 25 | |
| 26 | public boolean bigEndian; |
| 27 | public int type; |
| 28 | public long phoff; |
| 29 | public long shoff; |
| 30 | public int phentsize; |
| 31 | public int phnum; |
| 32 | public int shentsize; |
| 33 | public int shnum; |
| 34 | public int shstrndx; |
| 35 | |
| 36 | abstract public Elf.SectionHeader getSectionHeader(int index) throws IOException; |
| 37 | abstract public Elf.ProgramHeader getProgramHeader(long index) throws IOException; |
| 38 | abstract public Elf.DynamicStructure getDynamicStructure(long baseOffset, int index) |
| 39 | throws IOException; |
| 40 | } |
| 41 | |
| 42 | abstract class ProgramHeader { |
| 43 | public static final int PT_LOAD = 1; // Loadable segment |
| 44 | public static final int PT_DYNAMIC = 2; // Dynamic linking information |
| 45 | |
| 46 | public long type; |
| 47 | public long offset; |
| 48 | public long vaddr; |
| 49 | public long memsz; |
| 50 | } |
| 51 | |
| 52 | abstract class SectionHeader { |
| 53 | public long info; |
| 54 | } |
| 55 | |
| 56 | abstract class DynamicStructure { |
| 57 | public static final int DT_NULL = 0; // Marks end of structure list |
| 58 | public static final int DT_NEEDED = 1; // Needed library |
| 59 | public static final int DT_STRTAB = 5; // String table |
| 60 | |
| 61 | public long tag; |
| 62 | public long val; // Union with d_ptr |
| 63 | } |
| 64 | } |
nothing calls this directly
no outgoing calls
no test coverage detected