summaryrefslogtreecommitdiff
path: root/src/modelops/check.c
diff options
context:
space:
mode:
authornorly <ny-git@enpas.org>2013-06-20 01:56:24 +0100
committernorly <ny-git@enpas.org>2013-06-20 22:10:25 +0100
commitb70b3ff9b1679bb1e0a215b7acd9b6d55497a46b (patch)
treed6e95ad143c7e2ec9ca39c1dd32c046fb9006eb9 /src/modelops/check.c
parent7f1a29e9e33059dfebdc24bb3ffaa3dac46b58f1 (diff)
Separate library code, build .a/.so
Diffstat (limited to 'src/modelops/check.c')
-rw-r--r--src/modelops/check.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/modelops/check.c b/src/modelops/check.c
deleted file mode 100644
index 5234bef..0000000
--- a/src/modelops/check.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <libelfu/libelfu.h>
-
-
-int elfu_mCheck(ElfuElf *me)
-{
- size_t numSecs;
- ElfuScn **sortedSecs;
- size_t i;
-
- sortedSecs = elfu_mScnSortedByOffset(me, &numSecs);
- if (!sortedSecs) {
- return -1;
- }
-
-
- /* Check for overlapping sections */
- for (i = 0; i < numSecs - 1; i++) {
- if (sortedSecs[i]->shdr.sh_offset + SCNFILESIZE(&sortedSecs[i]->shdr)
- > sortedSecs[i+1]->shdr.sh_offset) {
- ELFU_WARN("elfu_check: Found overlapping sections: %s and %s.\n",
- elfu_mScnName(me, sortedSecs[i]),
- elfu_mScnName(me, sortedSecs[i+1]));
- }
- }
-
-
- /* Check for sections overlapping with EHDR */
- for (i = 0; i < numSecs; i++) {
- if (sortedSecs[i]->shdr.sh_offset < me->ehdr.e_ehsize) {
- ELFU_WARN("elfu_check: Found section overlapping with EHDR: %s.\n",
- elfu_mScnName(me, sortedSecs[i]));
- }
- }
-
-
- /* Check for sections overlapping with PHDRs */
- for (i = 0; i < numSecs; i++) {
- if (OVERLAPPING(sortedSecs[i]->shdr.sh_offset,
- SCNFILESIZE(&sortedSecs[i]->shdr),
- me->ehdr.e_phoff,
- me->ehdr.e_phentsize * me->ehdr.e_phnum)) {
- ELFU_WARN("elfu_check: Found section overlapping with PHDRs: %s.\n",
- elfu_mScnName(me, sortedSecs[i]));
- }
- }
-
-
- free(sortedSecs);
-
- return 0;
-}