Move section-in-segment.c to generic/
authornorly <ny-git@enpas.org>
Fri, 24 May 2013 02:48:14 +0000 (03:48 +0100)
committernorly <ny-git@enpas.org>
Fri, 24 May 2013 02:48:14 +0000 (03:48 +0100)
include/libelfu/elfops.h
include/libelfu/generic.h
src/elfops/phdr-contains-section.c [deleted file]
src/elfops/section-in-segment.c
src/generic/phdr-contains-section.c [new file with mode: 0644]
src/printing/sections.c
src/printing/segments.c

index b5e8a3f1830dfbd8596c447ab288773d6087547c..58da4cf2f17970c8408ec88e38a35b41f3ae39b9 100644 (file)
@@ -10,7 +10,6 @@
    char* elfu_eScnName(Elf *e, Elf_Scn *scn);
 Elf_Scn* elfu_eScnByName(Elf *e, char *name);
 
-     int elfu_ePhdrContainsScn(GElf_Phdr *phdr, GElf_Shdr *shdr);
 Elf_Scn* elfu_eScnFirstInSegment(Elf *e, GElf_Phdr *phdr);
 Elf_Scn* elfu_eScnLastInSegment(Elf *e, GElf_Phdr *phdr);
 
index 70157f7b7296ed3257d265e93fe700976f905bdf..f5b0e0f030e7ccba0c8e3746131b15a042f33217 100644 (file)
@@ -6,4 +6,6 @@
 
 size_t elfu_gScnSizeFile(const GElf_Shdr *shdr);
 
+int elfu_gPhdrContainsScn(GElf_Phdr *phdr, GElf_Shdr *shdr);
+
 #endif
diff --git a/src/elfops/phdr-contains-section.c b/src/elfops/phdr-contains-section.c
deleted file mode 100644 (file)
index 7a89d61..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <libelf/libelf.h>
-#include <libelf/gelf.h>
-
-#include <libelfu/libelfu.h>
-
-
-int elfu_ePhdrContainsScn(GElf_Phdr *phdr, GElf_Shdr *shdr)
-{
-  size_t secStart = shdr->sh_offset;
-  size_t secEnd   = shdr->sh_offset + shdr->sh_size;
-  size_t segStart = phdr->p_offset;
-  size_t segEnd   = phdr->p_offset + phdr->p_memsz;
-
-  if (secStart < segStart || secEnd > segEnd) {
-    return 0;
-  }
-
-  return 1;
-}
index 143c03f7a823336be60d556b198a784f2206d85a..185da364e3fad08ea0ac33a286ad0384ba1f8cb1 100644 (file)
@@ -25,7 +25,7 @@ Elf_Scn* elfu_eScnFirstInSegment(Elf *e, GElf_Phdr *phdr)
     }
 
     if (shdr.sh_offset == phdr->p_offset
-        && elfu_ePhdrContainsScn(phdr, &shdr)) {
+        && elfu_gPhdrContainsScn(phdr, &shdr)) {
       return scn;
     }
 
@@ -59,7 +59,7 @@ Elf_Scn* elfu_eScnLastInSegment(Elf *e, GElf_Phdr *phdr)
       continue;
     }
 
-    if (elfu_ePhdrContainsScn(phdr, &shdr)) {
+    if (elfu_gPhdrContainsScn(phdr, &shdr)) {
       if (!last) {
         last = scn;
       } else {
diff --git a/src/generic/phdr-contains-section.c b/src/generic/phdr-contains-section.c
new file mode 100644 (file)
index 0000000..4c1f2cf
--- /dev/null
@@ -0,0 +1,19 @@
+#include <libelf/libelf.h>
+#include <libelf/gelf.h>
+
+#include <libelfu/libelfu.h>
+
+
+int elfu_gPhdrContainsScn(GElf_Phdr *phdr, GElf_Shdr *shdr)
+{
+  size_t secStart = shdr->sh_offset;
+  size_t secEnd   = shdr->sh_offset + shdr->sh_size;
+  size_t segStart = phdr->p_offset;
+  size_t segEnd   = phdr->p_offset + phdr->p_memsz;
+
+  if (secStart < segStart || secEnd > segEnd) {
+    return 0;
+  }
+
+  return 1;
+}
index 3cdf270a757e857546fa67cb717102fa63c613b5..71431d14c606c1e9f34b6146681680b39f4f138b 100644 (file)
@@ -31,7 +31,7 @@ void printSegmentsWithSection(Elf *e, Elf_Scn *scn)
       continue;
     }
 
-    if (elfu_ePhdrContainsScn(&phdr, &shdr)) {
+    if (elfu_gPhdrContainsScn(&phdr, &shdr)) {
       printf("     %d %s\n", i, segmentTypeStr(phdr.p_type));
     }
   }
index f7ffd54a642f16908b70ea492bfe4c9fd2b62448..444f11577bdaaa64540d929299dabfa522aef208 100644 (file)
@@ -33,7 +33,7 @@ void printSectionsInSegment(Elf *e, GElf_Phdr *phdr)
       continue;
     }
 
-    if (elfu_ePhdrContainsScn(phdr, &shdr)) {
+    if (elfu_gPhdrContainsScn(phdr, &shdr)) {
       printf("       %10u %s\n", elf_ndxscn(scn), elfu_eScnName(e, scn));
     }