PR 34038 null pointer dereference in elf_link_output_extsym

When linking an ELF object file containing an STT_GNU_IFUNC symbol,
elf_link_output_extsym() unconditionally calls the backend's
elf_backend_finish_dynamic_symbol callback.  On targets that do not
support dynamic linking (and therefore do not define this callback),
the function pointer is NULL, causing a segmentation fault.

Add a NULL check for bed->elf_backend_finish_dynamic_symbol before
the indirect call.  This is consistent with the definition in
elfxx-target.h which defaults this callback to 0 (NULL) for targets
that do not override it.

Found by AFL++ fuzzing of the ELF linker with mutated object files.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
1 file changed