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);
size_t elfu_gScnSizeFile(const GElf_Shdr *shdr);
+int elfu_gPhdrContainsScn(GElf_Phdr *phdr, GElf_Shdr *shdr);
+
#endif
+++ /dev/null
-#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;
-}
}
if (shdr.sh_offset == phdr->p_offset
- && elfu_ePhdrContainsScn(phdr, &shdr)) {
+ && elfu_gPhdrContainsScn(phdr, &shdr)) {
return scn;
}
continue;
}
- if (elfu_ePhdrContainsScn(phdr, &shdr)) {
+ if (elfu_gPhdrContainsScn(phdr, &shdr)) {
if (!last) {
last = scn;
} else {
--- /dev/null
+#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;
+}
continue;
}
- if (elfu_ePhdrContainsScn(&phdr, &shdr)) {
+ if (elfu_gPhdrContainsScn(&phdr, &shdr)) {
printf(" %d %s\n", i, segmentTypeStr(phdr.p_type));
}
}
continue;
}
- if (elfu_ePhdrContainsScn(phdr, &shdr)) {
+ if (elfu_gPhdrContainsScn(phdr, &shdr)) {
printf(" %10u %s\n", elf_ndxscn(scn), elfu_eScnName(e, scn));
}