// GNU Build ID
char* build_id;
+
+ // GNU Debuglink
+ const char* debuglink;
};
static int pakfire_elf_init_libelf(struct pakfire_ctx* ctx) {
return self->build_id;
}
+const char* pakfire_elf_debuglink(struct pakfire_elf* self) {
+ GElf_Word crc32;
+
+ // Fetch the debug link
+ if (!self->debuglink) {
+ self->debuglink = dwelf_elf_gnu_debuglink(self->elf, &crc32);
+ if (!self->debuglink)
+ return NULL;
+
+ DEBUG(self->ctx, "%s has debug link pointing at %s\n",
+ self->path, self->debuglink);
+ }
+
+ return self->debuglink;
+}
+
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;
const char* pakfire_elf_path(struct pakfire_elf* self);
int pakfire_elf_type(struct pakfire_elf* self);
const char* pakfire_elf_build_id(struct pakfire_elf* self);
+const char* pakfire_elf_debuglink(struct pakfire_elf* self);
int pakfire_elf_is_stripped(struct pakfire_elf* self);
}
static int pakfire_linter_file_has_debuglink(struct pakfire_linter_file* lfile) {
- const char* name = NULL;
- GElf_Word crc32;
+ const char* debuglink = NULL;
// Fetch the debug link
- name = dwelf_elf_gnu_debuglink(lfile->elf, &crc32);
- if (!name)
+ debuglink = pakfire_elf_debuglink(lfile->_elf);
+ if (!debuglink)
return pakfire_linter_file_error(lfile, "Missing Debug Link");
- DEBUG(lfile->ctx, "%s has debug link pointing at %s\n", lfile->path, name);
-
return 0;
}