diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/elfhandle.h | 15 | ||||
-rw-r--r-- | include/libelfu/analysis.h | 11 | ||||
-rw-r--r-- | include/libelfu/libelfu.h | 11 | ||||
-rw-r--r-- | include/libelfu/lookup.h | 14 | ||||
-rw-r--r-- | include/libelfu/types.h | 10 | ||||
-rw-r--r-- | include/options.h | 16 | ||||
-rw-r--r-- | include/printing.h | 18 |
7 files changed, 95 insertions, 0 deletions
diff --git a/include/elfhandle.h b/include/elfhandle.h new file mode 100644 index 0000000..b1a92ea --- /dev/null +++ b/include/elfhandle.h @@ -0,0 +1,15 @@ +#ifndef __ELFHANDLE_H__ +#define __ELFHANDLE_H__ + +#include <libelf.h> + +typedef struct { + int fd; + Elf *e; +} ELFHandles; + + +void openElf(ELFHandles *h, char *fn, Elf_Cmd elfmode); +void closeElf(ELFHandles *h); + +#endif diff --git a/include/libelfu/analysis.h b/include/libelfu/analysis.h new file mode 100644 index 0000000..80ec251 --- /dev/null +++ b/include/libelfu/analysis.h @@ -0,0 +1,11 @@ +#ifndef __LIBELFU_ANALYSIS_H_ +#define __LIBELFU_ANALYSIS_H_ + +#include <libelf.h> +#include <gelf.h> + +#include <libelfu/types.h> + +ELFU_BOOL elfu_segmentContainsSection(GElf_Phdr *phdr, Elf_Scn *scn); + +#endif diff --git a/include/libelfu/libelfu.h b/include/libelfu/libelfu.h new file mode 100644 index 0000000..1c40541 --- /dev/null +++ b/include/libelfu/libelfu.h @@ -0,0 +1,11 @@ +#ifndef __LIBELFU_LIBELFU_H__ +#define __LIBELFU_LIBELFU_H__ + + +#include <libelfu/types.h> + +#include <libelfu/analysis.h> +#include <libelfu/lookup.h> + + +#endif diff --git a/include/libelfu/lookup.h b/include/libelfu/lookup.h new file mode 100644 index 0000000..2cca5df --- /dev/null +++ b/include/libelfu/lookup.h @@ -0,0 +1,14 @@ +#ifndef __LIBELFU_LOOKUP_H_ +#define __LIBELFU_LOOKUP_H_ + +#include <libelf.h> +#include <gelf.h> + +#include <libelfu/types.h> + +char* elfu_sectionName(Elf *e, Elf_Scn *scn); +Elf_Scn* elfu_sectionByName(Elf *e, char *name); +Elf_Scn* elfu_firstSectionInSegment(Elf *e, GElf_Phdr *phdr); +Elf_Scn* elfu_lastSectionInSegment(Elf *e, GElf_Phdr *phdr); + +#endif diff --git a/include/libelfu/types.h b/include/libelfu/types.h new file mode 100644 index 0000000..6ffdd84 --- /dev/null +++ b/include/libelfu/types.h @@ -0,0 +1,10 @@ +#ifndef __LIBELFU_TYPES_H__ +#define __LIBELFU_TYPES_H__ + +typedef enum { + ELFU_ERROR = -1, + ELFU_FALSE = 0, + ELFU_TRUE = 1 +} ELFU_BOOL; + +#endif diff --git a/include/options.h b/include/options.h new file mode 100644 index 0000000..f39f01e --- /dev/null +++ b/include/options.h @@ -0,0 +1,16 @@ +#ifndef __OPTIONS_H__ +#define __OPTIONS_H__ + + +typedef struct { + char *fnInput; + char *fnOutput; + int printHeader; + int printSegments; + int printSections; +} CLIOpts; + + +void parseOptions(CLIOpts *opts, int argc, char **argv); + +#endif diff --git a/include/printing.h b/include/printing.h new file mode 100644 index 0000000..bda2fc1 --- /dev/null +++ b/include/printing.h @@ -0,0 +1,18 @@ +#ifndef __PRINTING_H__ +#define __PRINTING_H__ + +#include <libelf.h> + + +void printHeader(Elf *e); + +void printSegmentsWithSection(Elf *e, Elf_Scn *scn); +void printSection(Elf *e, Elf_Scn *scn); +void printSections(Elf *e); + +char* segmentTypeStr(size_t pt); +void printSectionsInSegment(Elf *e, GElf_Phdr *phdr); +void printSegments(Elf *e); + + +#endif |