goto ERROR;
}
+ if (file->issues & PAKFIRE_FILE_MISSING_DEBUGINFO) {
+ r = asprintf(&buffer, "%s [MISSING-DEBUGINFO]", buffer);
+ if (r < 0)
+ goto ERROR;
+ }
+
if (pakfire_file_matches_class(file, PAKFIRE_FILE_ELF)) {
// Stack-smashing Protection
if (file->issues & PAKFIRE_FILE_NO_SSP) {
return type;
}
-static int __pakfire_file_is_stripped(struct pakfire_file* file, Elf* elf, void* data) {
+static int __pakfire_file_check_debuginfo(struct pakfire_file* file, Elf* elf, void* data) {
Elf_Scn* section = NULL;
GElf_Shdr shdr;
// Not found
DEBUG(file->pakfire, "%s has no debug sections\n", file->path);
- return 1;
-}
+ // Store the result
+ file->issues |= PAKFIRE_FILE_MISSING_DEBUGINFO;
-int pakfire_file_is_stripped(struct pakfire_file* file) {
- // Don't run this for non-ELF files
- if (!pakfire_file_matches_class(file, PAKFIRE_FILE_ELF)) {
- errno = EINVAL;
- return -1;
- }
-
- // Do not perform this check on firmware
- if (pakfire_file_matches_class(file, PAKFIRE_FILE_FIRMWARE))
- return 0;
+ return 0;
+}
+static int pakfire_file_check_debuginfo(struct pakfire_file* file) {
switch (pakfire_file_get_elf_type(file)) {
// Do not check Relocatable Objects
case ET_REL:
break;
}
- return pakfire_file_open_elf(file, __pakfire_file_is_stripped, NULL);
+ return pakfire_file_open_elf(file, __pakfire_file_check_debuginfo, NULL);
}
static int __pakfire_file_check_ssp(
if (pakfire_file_matches_class(file, PAKFIRE_FILE_RUNTIME_LINKER))
return 0;
+ // We cannot perform this check if we don't have debuginfo
+ if (file->issues & PAKFIRE_FILE_MISSING_DEBUGINFO)
+ return 0;
+
return pakfire_file_open_elf(file, __pakfire_file_check_ssp, NULL);
}
break;
}
+ // Check if the file has debug info
+ r = pakfire_file_check_debuginfo(file);
+ if (r)
+ return r;
+
// Check for SSP
r = pakfire_file_check_ssp(file);
if (r)