diff options
author | Alan Modra <amodra@gmail.com> | 2023-09-19 09:39:31 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-09-20 08:23:47 +0930 |
commit | a1d1634d0012ddeecc59bb0e6012d4455edae6e8 (patch) | |
tree | ba213a2d27da84a2ec41bc2a1e7fc6ac23730131 /gas/config/tc-mips.c | |
parent | a56e5dce69bfad45ee6977a916ccea283e087e8b (diff) | |
download | gdb-a1d1634d0012ddeecc59bb0e6012d4455edae6e8.zip gdb-a1d1634d0012ddeecc59bb0e6012d4455edae6e8.tar.gz gdb-a1d1634d0012ddeecc59bb0e6012d4455edae6e8.tar.bz2 |
elf-attrs.c memory allocation fail
Report errors rather than segfaulting.
bfd/
* elf-attrs.c (elf_new_obj_attr): Return NULL on bfd_alloc fail.
(bfd_elf_add_obj_attr_int): Handle NULL return from the above,
and propagate return to callers.
(elf_add_obj_attr_string, elf_add_obj_attr_int_string): Likewise.
(bfd_elf_add_obj_attr_string): Similarly.
(_bfd_elf_copy_obj_attributes): Report error on alloc fails.
(_bfd_elf_parse_attributes): Likewise.
* elf-bfd.h (bfd_elf_add_obj_attr_int): Update prototype.
(bfd_elf_add_obj_attr_string): Likewise.
(bfd_elf_add_obj_attr_int_string): Likewise.
gas/
* config/obj-elf.c (obj_elf_vendor_attribute): Report fatal
error on out of memory from bfd attribute functions.
* config/tc-arc.c (arc_set_attribute_int): Likewise.
(arc_set_attribute_string, arc_set_public_attributes): Likewise.
* config/tc-arm.c (aeabi_set_attribute_int): Likewise.
(aeabi_set_attribute_string): Likewise.
* config/tc-mips.c (mips_md_finish): Likewise.
* config/tc-msp430.c (msp430_md_finish): Likewise.
* config/tc-riscv.c (riscv_write_out_attrs): Likewise.
* config/tc-sparc.c (sparc_md_finish): Likewise.
* config/tc-tic6x.c (tic6x_set_attribute_int): Likewise.
* config/tc-csky.c (md_begin): Likewise.
(set_csky_attribute): Return ok status.
Diffstat (limited to 'gas/config/tc-mips.c')
-rw-r--r-- | gas/config/tc-mips.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index d6aae66..24cef90 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -20626,8 +20626,10 @@ mips_md_finish (void) } } - bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU, - Tag_GNU_MIPS_ABI_FP, fpabi); + if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU, + Tag_GNU_MIPS_ABI_FP, fpabi)) + as_fatal (_("error adding attribute: %s"), + bfd_errmsg (bfd_get_error ())); } } |