The RISCV_ATTRIBUTES segment is not meant to be loaded.
Signed-off-by: Andreas Schwab <schwab@suse.de>
+2022-08-09 Andreas Schwab <schwab@suse.de>
+
+ * elflint.c (check_program_header): Don't complain about p_filesz
+ > p_memsz if p_memsz is zero and p_type is PT_RISCV_ATTRIBUTES.
+
2022-08-01 Mark Wielaard <mark@klomp.org>
* readelf.c (handle_dynamic): Pass start of buffer to memrchr.
}
if (phdr->p_filesz > phdr->p_memsz
- && (phdr->p_memsz != 0 || phdr->p_type != PT_NOTE))
+ && (phdr->p_memsz != 0
+ || (phdr->p_type != PT_NOTE
+ && !(ehdr->e_machine == EM_RISCV
+ && phdr->p_type == PT_RISCV_ATTRIBUTES))))
ERROR (_("\
program header entry %d: file size greater than memory size\n"),
cnt);