Move ELF-related files together
[centaur.git] / src / lookup / section-by-name.c
diff --git a/src/lookup/section-by-name.c b/src/lookup/section-by-name.c
deleted file mode 100644 (file)
index 1697140..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <string.h>
-
-#include <libelf.h>
-#include <gelf.h>
-
-#include <libelfu/libelfu.h>
-
-
-Elf_Scn* elfu_sectionByName(Elf *e, char *name)
-{
-  size_t shstrndx;
-  Elf_Scn *scn;
-
-  if (elf_getshdrstrndx(e, &shstrndx) != 0) {
-    return NULL;
-  }
-
-  scn = elf_getscn(e, 1);
-  while (scn) {
-    GElf_Shdr shdr;
-    char *curname;
-
-    if (gelf_getshdr(scn, &shdr) != &shdr) {
-      return NULL;
-    }
-
-    /* elf_strptr returns NULL if there was an error */
-    curname = elf_strptr(e, shstrndx, shdr.sh_name);
-
-    /* strcmp... but we really have no bounds on the lengths here */
-    if (!strcmp(curname, name)) {
-      return scn;
-    }
-
-    scn = elf_nextscn(e, scn);
-  }
-
-  return NULL;
-}