Bug 29823 - ld riscv: undefined elf_backend_obj_attrs_handle_unknown causes segfault when merging .riscv.attributes
Summary: ld riscv: undefined elf_backend_obj_attrs_handle_unknown causes segfault when...
Status: NEW
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.40
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-23 17:42 UTC by Fangrui Song
Modified: 2023-05-15 04:46 UTC (History)
2 users (show)

See Also:
Host:
Target: riscv64-*-*
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fangrui Song 2022-11-23 17:42:13 UTC
% cat a.s
.attribute 9, "0"
% riscv64-linux-gnu-gcc -c a.s
% ~/Dev/binutils-gdb/out/riscv64/ld/ld-new a.o a.o
[1]    3982286 segmentation fault  ~/Dev/binutils-gdb/out/riscv64/ld/ld-new a.o a.o

lang_check=>_bfd_riscv_elf_merge_private_bfd_data=>riscv_merge_attributes => `result &= _bfd_elf_merge_unknown_attribute_low (ibfd, obfd, i);` => `get_elf_backend_data (err_bfd)->obj_attrs_handle_unknown (err_bfd, tag);` => null pointer dereference