aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@orcam.me.uk>2026-01-14 22:28:43 +0000
committerMaciej W. Rozycki <macro@orcam.me.uk>2026-01-14 22:28:43 +0000
commitca2186f9ca89e4d0602e67d2ecca997c8a097aa6 (patch)
tree22bf6ff2329ae436a054f1ef1cc733e15b356202 /binutils
parente9499dfeb3af65cadf12bb32db24efdd5adb7427 (diff)
downloadbinutils-ca2186f9ca89e4d0602e67d2ecca997c8a097aa6.tar.gz
binutils-ca2186f9ca89e4d0602e67d2ecca997c8a097aa6.tar.bz2
binutils-ca2186f9ca89e4d0602e67d2ecca997c8a097aa6.zip
BFD: Make `bfd_finalize_section_relocs' return status
Update `bfd_finalize_section_relocs' to return status so that backends can fail in this interface and propagate that to the respective callers. Add suitable error reporting there. No failure cases in the existing handlers though.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/objcopy.c11
-rw-r--r--binutils/rescoff.c8
2 files changed, 15 insertions, 4 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index aea69ba886a..5f44c6295f2 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -4555,7 +4555,10 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isection, bfd *obfd)
}
if (relsize == 0)
- bfd_finalize_section_relocs (obfd, osection, NULL, 0);
+ {
+ if (!bfd_finalize_section_relocs (obfd, osection, NULL, 0))
+ return false;
+ }
else
{
if (isection->orelocation != NULL)
@@ -4596,8 +4599,10 @@ copy_relocations_in_section (bfd *ibfd, sec_ptr isection, bfd *obfd)
*w_relpp = 0;
}
- bfd_finalize_section_relocs (obfd, osection,
- relcount == 0 ? NULL : relpp, relcount);
+ if (!bfd_finalize_section_relocs (obfd, osection,
+ relcount == 0 ? NULL : relpp,
+ relcount))
+ return false;
}
return true;
}
diff --git a/binutils/rescoff.c b/binutils/rescoff.c
index afeadf161c1..6b07ddd2bcb 100644
--- a/binutils/rescoff.c
+++ b/binutils/rescoff.c
@@ -685,7 +685,13 @@ write_coff_file (const char *filename, const char *target,
return false;
}
- bfd_finalize_section_relocs (abfd, sec, cwi.relocs, cwi.reloc_count);
+ if (!bfd_finalize_section_relocs (abfd, sec, cwi.relocs, cwi.reloc_count))
+ {
+ bfd_nonfatal ("bfd_finalize_section_relocs");
+ bfd_close_all_done (abfd);
+ free (cwi.relocs);
+ return false;
+ }
offset = 0;
for (d = cwi.dirs.d; d != NULL; d = d->next)