return self->build_id;
}
+
+static int pakfire_elf_get_section(struct pakfire_elf* self,
+ const Elf64_Word type, Elf_Scn** section, GElf_Shdr* header, Elf_Data** data) {
+ Elf_Scn* s = NULL;
+ GElf_Shdr shdr;
+
+ // Walk through all sections
+ for (;;) {
+ s = elf_nextscn(self->elf, s);
+ if (!s)
+ break;
+
+ // Fetch the section header
+ gelf_getshdr(s, &shdr);
+
+ // Return any matching sections
+ if (shdr.sh_type == type) {
+ *section = s;
+
+ // Send header if requested
+ if (header)
+ gelf_getshdr(s, header);
+
+ // Send data if requested
+ if (data)
+ *data = elf_getdata(s, NULL);
+
+ return 0;
+ }
+ }
+
+ // No section found
+ return 1;
+}
+
+int pakfire_elf_is_stripped(struct pakfire_elf* self) {
+ Elf_Scn* symtab = NULL;
+
+ switch (pakfire_elf_type(self)) {
+ // Do not check Relocatable Objects
+ case ET_REL:
+ return 0;
+
+ // Check everything else
+ default:
+ break;
+ }
+
+ // Fetch the symbol table
+ return pakfire_elf_get_section(self, SHT_SYMTAB, &symtab, NULL, NULL);
+}
int pakfire_elf_type(struct pakfire_elf* self);
const char* pakfire_elf_build_id(struct pakfire_elf* self);
+int pakfire_elf_is_stripped(struct pakfire_elf* self);
+
#endif /* PAKFIRE_PRIVATE */
#endif /* PAKFIRE_ELF_H */