#include <stdio.h>
-#include <libelf.h>
-#include <gelf.h>
+#include <libelf/libelf.h>
+#include <libelf/gelf.h>
#include <libelfu/libelfu.h>
scn = elf_getscn(e, 0);
while (scn) {
- ELFU_BOOL isInSeg;
+ GElf_Shdr shdr;
- isInSeg = elfu_segmentContainsSection(phdr, scn);
- if (isInSeg == ELFU_TRUE) {
- printf(" %10u %s\n", elf_ndxscn(scn), elfu_sectionName(e, scn));
+ if (gelf_getshdr(scn, &shdr) != &shdr) {
+ fprintf(stderr, "gelf_getshdr() failed: %s\n", elf_errmsg(-1));
+ continue;
+ }
+
+ if (PHDR_CONTAINS_SCN_IN_MEMORY(phdr, &shdr)) {
+ printf(" %10u %s\n", elf_ndxscn(scn), elfu_eScnName(e, scn));
}
scn = elf_nextscn(e, scn);