[PATCH] elf: Return false if output_section is NULL

H.J. Lu hjl.tools@gmail.com
Fri Jun 13 05:39:50 GMT 2025


Return false if output_section is NULL so that on input

https://sourceware.org/bugzilla/attachment.cgi?id=16131

objcopy generates

objcopy: /tmp/objcopy-poc(OrcError.cpp.o): invalid entry (0x22000000) in group [
3]
objcopy: /tmp/objcopy-poc(OrcError.cpp.o): invalid entry (0x21000000) in group [
3]
objcopy: /tmp/objcopy-poc(OrcError.cpp.o)(.text._ZNK12_GLOBAL__N_116OrcErrorCate
gory7messageB5cxx11Ei): relocation 29 has invalid symbol index 1160982879
objcopy: /tmp/stv73zYw/OrcError.cpp.o[.text._ZN4llvm3orc8orcErrorENS0_12OrcError
CodeE]: bad value

instead of

objcopy: /tmp/objcopy-poc(OrcError.cpp.o): invalid entry (0x22000000) in group [
3]
objcopy: /tmp/objcopy-poc(OrcError.cpp.o): invalid entry (0x21000000) in group [
3]
objcopy: /tmp/objcopy-poc(OrcError.cpp.o)(.text._ZNK12_GLOBAL__N_116OrcErrorCate
gory7messageB5cxx11Ei): relocation 29 has invalid symbol index 1160982879
Segmentation fault (core dumped)

PR binutils/33075
* elf.c (elf_map_symbols): Return false if output_section is
NULL.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-elf-Return-false-if-output_section-is-NULL.patch
Type: text/x-patch
Size: 1766 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20250613/80fc1801/attachment.bin>


More information about the Binutils mailing list