diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-10-15 21:44:28 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-10-15 21:44:28 (GMT) |
commit | 1e7c7de85438749d3faf7b76984b86a9c088fbc1 (patch) | |
tree | 8d118fd269c23d019e7c7d8bd60c33c0c8809a56 | |
parent | 105394bcc19b3565c6b77d38625d8813596d0c1b (diff) |
Refactored ELF related code.
25 files changed, 100 insertions, 73 deletions
@@ -1,3 +1,41 @@ +17-10-15 Cyrille Bagard <nocbos@gmail.com> + + * plugins/elf/Makefile.am: + * plugins/elf/core.c: + * plugins/elf/dynamic.h: + * plugins/elf/elf-int.h: + * plugins/elf/elf_def.h: + * plugins/elf/elf_def_arm.h: + Refactor ELF related code. + + * plugins/elf/format.c: + * plugins/elf/format.h: + Renamed entries. + + * plugins/elf/helper_arm.h: + * plugins/elf/loading.h: + * plugins/elf/program.h: + * plugins/elf/python/Makefile.am: + Refactor ELF related code. + + * plugins/elf/python/format.c: + * plugins/elf/python/format.h: + Renamed entries. + + * plugins/elf/python/module.c: + * plugins/elf/section.h: + * plugins/elf/strings.h: + * plugins/elf/symbols.h: + Refactor ELF related code. + + * plugins/libcsem/semantic.c: + * plugins/readelf/header.c: + * plugins/readelf/program.h: + * plugins/readelf/reader.c: + * plugins/readelf/section.h: + * plugins/readelf/strtab.h: + Update code. + 17-10-04 Cyrille Bagard <nocbos@gmail.com> * plugins/elf/core.c: diff --git a/plugins/elf/Makefile.am b/plugins/elf/Makefile.am index d3cfe05..6d7fb58 100644 --- a/plugins/elf/Makefile.am +++ b/plugins/elf/Makefile.am @@ -4,9 +4,9 @@ lib_LTLIBRARIES = libelf.la libelf_la_SOURCES = \ core.h core.c \ elf-int.h elf-int.c \ - elf.h elf.c \ elf_def.h \ elf_def_arm.h \ + format.h format.c \ dynamic.h dynamic.c \ helper_arm.h helper_arm.c \ loading.h loading.c \ @@ -22,7 +22,7 @@ libelf_la_LDFLAGS = \ $(LIBPYTHON_LIBS) $(LIBPYGOBJECT_LIBS) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) $(LIBXML_CFLAGS) -I../../src +AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) $(LIBXML_CFLAGS) -I$(top_srcdir)/src AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) diff --git a/plugins/elf/core.c b/plugins/elf/core.c index fde6be1..ebd980e 100644 --- a/plugins/elf/core.c +++ b/plugins/elf/core.c @@ -28,7 +28,7 @@ #include <plugins/plugin-def.h> -#include "elf.h" +#include "format.h" #include "python/module.h" diff --git a/plugins/elf/dynamic.h b/plugins/elf/dynamic.h index 7fce1d4..ee5d3d8 100644 --- a/plugins/elf/dynamic.h +++ b/plugins/elf/dynamic.h @@ -21,12 +21,12 @@ */ -#ifndef _FORMAT_ELF_DYNAMIC_H -#define _FORMAT_ELF_DYNAMIC_H +#ifndef _PLUGINS_ELF_DYNAMIC_H +#define _PLUGINS_ELF_DYNAMIC_H -#include "elf.h" #include "elf_def.h" +#include "format.h" @@ -38,4 +38,4 @@ bool find_elf_dynamic_item_from_pheader(const GElfFormat *, const elf_phdr *, in -#endif /* _FORMAT_ELF_DYNAMIC_H */ +#endif /* _PLUGINS_ELF_DYNAMIC_H */ diff --git a/plugins/elf/elf-int.h b/plugins/elf/elf-int.h index 34f15cb..3b4b67c 100644 --- a/plugins/elf/elf-int.h +++ b/plugins/elf/elf-int.h @@ -21,16 +21,16 @@ */ -#ifndef _FORMAT_ELF_ELF_INT_H -#define _FORMAT_ELF_ELF_INT_H +#ifndef _PLUGINS_ELF_ELF_INT_H +#define _PLUGINS_ELF_ELF_INT_H #include <common/endianness.h> #include <format/executable-int.h> -#include "elf.h" #include "elf_def.h" +#include "format.h" @@ -77,4 +77,4 @@ bool read_elf_note(const GElfFormat *, GBinContent *, phys_t *, elf_note *); -#endif /* _FORMAT_ELF_ELF_INT_H */ +#endif /* _PLUGINS_ELF_ELF_INT_H */ diff --git a/plugins/elf/elf_def.h b/plugins/elf/elf_def.h index 0d91e00..5ab915a 100644 --- a/plugins/elf/elf_def.h +++ b/plugins/elf/elf_def.h @@ -21,8 +21,8 @@ */ -#ifndef _FORMAT_ELF_ELF_DEF_H -#define _FORMAT_ELF_ELF_DEF_H +#ifndef _PLUGINS_ELF_ELF_DEF_H +#define _PLUGINS_ELF_ELF_DEF_H #include <stdint.h> @@ -427,9 +427,6 @@ typedef union _elf_shdr referenced or allocated (Solaris).*/ - - - /* ----------------------------- DONNEES POUR LE LINKER ----------------------------- */ @@ -631,4 +628,4 @@ typedef struct _elf_note -#endif /* _FORMAT_ELF_ELF_DEF_H */ +#endif /* _PLUGINS_ELF_ELF_DEF_H */ diff --git a/plugins/elf/elf_def_arm.h b/plugins/elf/elf_def_arm.h index 5b0191e..2b0f3d7 100644 --- a/plugins/elf/elf_def_arm.h +++ b/plugins/elf/elf_def_arm.h @@ -21,8 +21,8 @@ */ -#ifndef _FORMAT_ELF_ELF_DEF_ARM_H -#define _FORMAT_ELF_ELF_DEF_ARM_H +#ifndef _PLUGINS_ELF_ELF_DEF_ARM_H +#define _PLUGINS_ELF_ELF_DEF_ARM_H #include "elf_def.h" @@ -42,4 +42,4 @@ -#endif /* _FORMAT_ELF_ELF_DEF_ARM_H */ +#endif /* _PLUGINS_ELF_ELF_DEF_ARM_H */ diff --git a/plugins/elf/elf.c b/plugins/elf/format.c index 04ee031..c12460a 100644 --- a/plugins/elf/elf.c +++ b/plugins/elf/format.c @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * elf.c - support du format ELF + * format.c - support du format ELF * * Copyright (C) 2009-2017 Cyrille Bagard * @@ -21,7 +21,7 @@ */ -#include "elf.h" +#include "format.h" #include <malloc.h> diff --git a/plugins/elf/elf.h b/plugins/elf/format.h index 7e1895b..5184219 100644 --- a/plugins/elf/elf.h +++ b/plugins/elf/format.h @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * elf.h - prototypes pour le support du format ELF + * format.h - prototypes pour le support du format ELF * * Copyright (C) 2009-2017 Cyrille Bagard * @@ -21,8 +21,8 @@ */ -#ifndef _FORMAT_ELF_ELF_H -#define _FORMAT_ELF_ELF_H +#ifndef _PLUGINS_ELF_FORMAT_H +#define _PLUGINS_ELF_FORMAT_H #include <glib-object.h> @@ -65,4 +65,4 @@ const elf_header *g_elf_format_get_header(const GElfFormat *); -#endif /* _FORMAT_ELF_ELF_H */ +#endif /* _PLUGINS_ELF_FORMAT_H */ diff --git a/plugins/elf/helper_arm.h b/plugins/elf/helper_arm.h index e971ed6..d4be96c 100644 --- a/plugins/elf/helper_arm.h +++ b/plugins/elf/helper_arm.h @@ -21,8 +21,8 @@ */ -#ifndef _FORMAT_ELF_HELPER_ARM_H -#define _FORMAT_ELF_HELPER_ARM_H +#ifndef _PLUGINS_ELF_HELPER_ARM_H +#define _PLUGINS_ELF_HELPER_ARM_H #include "section.h" @@ -37,4 +37,4 @@ bool load_elf_arm_relocated_symbols(GElfFormat *, const elf_shdr *, const elf_sh -#endif /* _FORMAT_ELF_HELPER_ARM_H */ +#endif /* _PLUGINS_ELF_HELPER_ARM_H */ diff --git a/plugins/elf/loading.h b/plugins/elf/loading.h index ff5d7bb..03ac184 100644 --- a/plugins/elf/loading.h +++ b/plugins/elf/loading.h @@ -21,22 +21,14 @@ */ -#ifndef _FORMAT_ELF_LOADING_H -#define _FORMAT_ELF_LOADING_H +#ifndef _PLUGINS_ELF_LOADING_H +#define _PLUGINS_ELF_LOADING_H #include <gtkext/gtkstatusstack.h> -#include "elf.h" - - - - -//#include "../routine.h" -//#include "../../arch/processor.h" -//#include "../../format/executable.h" -//#include "../../gtkext/gtkstatusstack.h" +#include "format.h" @@ -70,4 +62,4 @@ void g_elf_loading_get_internal_info(GElfLoading *, const elf_shdr **, bool *, c -#endif /* _FORMAT_ELF_LOADING_H */ +#endif /* _PLUGINS_ELF_LOADING_H */ diff --git a/plugins/elf/program.h b/plugins/elf/program.h index bf05d2a..91de4ec 100644 --- a/plugins/elf/program.h +++ b/plugins/elf/program.h @@ -21,12 +21,12 @@ */ -#ifndef _FORMAT_ELF_PROGRAM_H -#define _FORMAT_ELF_PROGRAM_H +#ifndef _PLUGINS_ELF_PROGRAM_H +#define _PLUGINS_ELF_PROGRAM_H -#include "elf.h" #include "elf_def.h" +#include "format.h" @@ -44,4 +44,4 @@ bool translate_address_into_vmpa_using_elf_programs(const GElfFormat *, virt_t, -#endif /* _FORMAT_ELF_PROGRAM_H */ +#endif /* _PLUGINS_ELF_PROGRAM_H */ diff --git a/plugins/elf/python/Makefile.am b/plugins/elf/python/Makefile.am index 4de3e3c..c39d170 100644 --- a/plugins/elf/python/Makefile.am +++ b/plugins/elf/python/Makefile.am @@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libelfpython.la libelfpython_la_SOURCES = \ - elf.h elf.c \ + format.h format.c \ module.h module.c @@ -10,6 +10,6 @@ libelfpython_la_LDFLAGS = AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \ - -I../../../src -I../../.. + -I$(top_srcdir)/src AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) diff --git a/plugins/elf/python/elf.c b/plugins/elf/python/format.c index 1f5ddb2..84aa68c 100644 --- a/plugins/elf/python/elf.c +++ b/plugins/elf/python/format.c @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * elf.c - équivalent Python du fichier "format/elf/elf.c" + * format.c - équivalent Python du fichier "plugins/elf/format.c" * * Copyright (C) 2013-2017 Cyrille Bagard * @@ -22,7 +22,7 @@ */ -#include "elf.h" +#include "format.h" #include <pygobject.h> @@ -36,7 +36,7 @@ #include <plugins/pychrysa/format/executable.h> -#include "../elf.h" +#include "../format.h" diff --git a/plugins/elf/python/elf.h b/plugins/elf/python/format.h index cf6a706..10e7a13 100644 --- a/plugins/elf/python/elf.h +++ b/plugins/elf/python/format.h @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * elf.h - prototypes pour l'équivalent Python du fichier "format/elf/elf.h" + * format.h - prototypes pour l'équivalent Python du fichier "plugins/elf/format.h" * * Copyright (C) 2013-2017 Cyrille Bagard * @@ -22,8 +22,8 @@ */ -#ifndef _PLUGINS_PYCHRYSA_FORMAT_ELF_ELF_H -#define _PLUGINS_PYCHRYSA_FORMAT_ELF_ELF_H +#ifndef _PLUGINS_ELF_PYTHON_FORMAT_H +#define _PLUGINS_ELF_PYTHON_FORMAT_H #include <Python.h> @@ -39,4 +39,4 @@ bool register_python_elf_format(PyObject *); -#endif /* _PLUGINS_PYCHRYSA_FORMAT_ELF_ELF_H */ +#endif /* _PLUGINS_ELF_PYTHON_FORMAT_H */ diff --git a/plugins/elf/python/module.c b/plugins/elf/python/module.c index faf0458..72d6dfc 100644 --- a/plugins/elf/python/module.c +++ b/plugins/elf/python/module.c @@ -31,7 +31,7 @@ #include <plugins/pychrysa/access.h> -#include "elf.h" +#include "format.h" diff --git a/plugins/elf/section.h b/plugins/elf/section.h index f3be0f4..4ee2695 100644 --- a/plugins/elf/section.h +++ b/plugins/elf/section.h @@ -21,12 +21,12 @@ */ -#ifndef _FORMAT_ELF_SECTION_H -#define _FORMAT_ELF_SECTION_H +#ifndef _PLUGINS_ELF_SECTION_H +#define _PLUGINS_ELF_SECTION_H -#include "elf.h" #include "elf_def.h" +#include "format.h" @@ -65,4 +65,4 @@ bool translate_address_into_vmpa_using_elf_sections(const GElfFormat *, virt_t, -#endif /* _FORMAT_ELF_SECTION_H */ +#endif /* _PLUGINS_ELF_SECTION_H */ diff --git a/plugins/elf/strings.h b/plugins/elf/strings.h index bea52da..456bd0a 100644 --- a/plugins/elf/strings.h +++ b/plugins/elf/strings.h @@ -21,11 +21,11 @@ */ -#ifndef _FORMAT_ELF_STRINGS_H -#define _FORMAT_ELF_STRINGS_H +#ifndef _PLUGINS_ELF_STRINGS_H +#define _PLUGINS_ELF_STRINGS_H -#include "elf.h" +#include "format.h" @@ -34,4 +34,4 @@ bool find_all_elf_strings(GElfFormat *); -#endif /* _FORMAT_ELF_STRINGS_H */ +#endif /* _PLUGINS_ELF_STRINGS_H */ diff --git a/plugins/elf/symbols.h b/plugins/elf/symbols.h index f0bfa0d..c5e150b 100644 --- a/plugins/elf/symbols.h +++ b/plugins/elf/symbols.h @@ -21,11 +21,11 @@ */ -#ifndef _FORMAT_ELF_SYMBOLS_H -#define _FORMAT_ELF_SYMBOLS_H +#ifndef _PLUGINS_ELF_SYMBOLS_H +#define _PLUGINS_ELF_SYMBOLS_H -#include "elf.h" +#include "format.h" #include <glibext/delayed.h> @@ -50,4 +50,4 @@ const char *get_elf_symbol_name(GElfFormat *, const elf_shdr *, const elf_shdr * -#endif /* _FORMAT_ELF_SYMBOLS_H */ +#endif /* _PLUGINS_ELF_SYMBOLS_H */ diff --git a/plugins/libcsem/semantic.c b/plugins/libcsem/semantic.c index 8fdc549..efac9ad 100644 --- a/plugins/libcsem/semantic.c +++ b/plugins/libcsem/semantic.c @@ -24,7 +24,7 @@ #include "semantic.h" -#include <plugins/elf/elf.h> +#include <plugins/elf/format.h> #include <plugins/plugin-def.h> diff --git a/plugins/readelf/header.c b/plugins/readelf/header.c index 8b124a4..71ce749 100644 --- a/plugins/readelf/header.c +++ b/plugins/readelf/header.c @@ -24,7 +24,7 @@ #include "header.h" -#include <plugins/elf/elf.h> +#include <plugins/elf/format.h> #include <plugins/fmtp/parser.h> diff --git a/plugins/readelf/program.h b/plugins/readelf/program.h index 4c4cde4..14b814d 100644 --- a/plugins/readelf/program.h +++ b/plugins/readelf/program.h @@ -26,7 +26,7 @@ #include <format/preload.h> -#include <plugins/elf/elf.h> +#include <plugins/elf/format.h> diff --git a/plugins/readelf/reader.c b/plugins/readelf/reader.c index 4d766da..1a9158e 100644 --- a/plugins/readelf/reader.c +++ b/plugins/readelf/reader.c @@ -24,7 +24,7 @@ #include "reader.h" -#include <plugins/elf/elf.h> +#include <plugins/elf/format.h> #include <plugins/plugin-def.h> diff --git a/plugins/readelf/section.h b/plugins/readelf/section.h index 33be014..c50cd3a 100644 --- a/plugins/readelf/section.h +++ b/plugins/readelf/section.h @@ -26,7 +26,7 @@ #include <format/preload.h> -#include <plugins/elf/elf.h> +#include <plugins/elf/format.h> diff --git a/plugins/readelf/strtab.h b/plugins/readelf/strtab.h index 9adcd46..e5a0a05 100644 --- a/plugins/readelf/strtab.h +++ b/plugins/readelf/strtab.h @@ -26,7 +26,7 @@ #include <format/preload.h> -#include <plugins/elf/elf.h> +#include <plugins/elf/format.h> |