Bugifx: Fix CRCs not being written to section
This commit is contained in:
parent
dafd51a376
commit
9aa82975b1
@ -633,17 +633,10 @@ int elf_patch_write_crcs_to_section(elfpatch_handle_t *ep, const char *section,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update ELF file */
|
/* Flag section data as invalid to trigger rewrite.
|
||||||
if (ep->readonly) {
|
* This is needed to to the forced memory layout
|
||||||
print_debug("DRY RUN: File will not be updated\n");
|
*/
|
||||||
ret = 0;
|
elf_flagdata(output_sec_data, ELF_C_SET, ELF_F_DIRTY);
|
||||||
} else {
|
|
||||||
if (elf_update(ep->elf, ELF_C_WRITE) < 0) {
|
|
||||||
print_err("Error writing ELF file: %s\n", elf_errmsg(-1));
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ret_err:
|
ret_err:
|
||||||
return ret;
|
return ret;
|
||||||
@ -653,6 +646,17 @@ void elf_patch_close_and_free(elfpatch_handle_t *ep)
|
|||||||
{
|
{
|
||||||
ret_if_ep_err(ep);
|
ret_if_ep_err(ep);
|
||||||
|
|
||||||
|
if (ep->elf) {
|
||||||
|
/* Update ELF file */
|
||||||
|
if (ep->readonly) {
|
||||||
|
print_debug("DRY RUN: File will not be updated\n");
|
||||||
|
} else {
|
||||||
|
if (elf_update(ep->elf, ELF_C_WRITE) < 0) {
|
||||||
|
print_err("Error writing ELF file: %s\n", elf_errmsg(-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ep->elf)
|
if (ep->elf)
|
||||||
elf_end(ep->elf);
|
elf_end(ep->elf);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user