[PATCH] Fix segmentation fault in bfd/elf32-hppa.c
Alan Modra
amodra@gmail.com
Wed Dec 13 00:01:41 GMT 2023
On Tue, Dec 12, 2023 at 05:21:28PM +0000, John David Anglin wrote:
> diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
> index 44129c80138..131f6806aa7 100644
> --- a/bfd/elf32-hppa.c
> +++ b/bfd/elf32-hppa.c
> @@ -4216,7 +4216,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
> file, we just want to emit a RELATIVE reloc. The entry
> in the global offset table will already have been
> initialized in the relocate_section function. */
> - if (!is_dyn)
> + if (!is_dyn && eh->root.type != bfd_link_hash_undefined)
> {
> rela.r_info = ELF32_R_INFO (0, R_PARISC_DIR32);
> rela.r_addend = (eh->root.u.def.value
Since the code uses u.def here, it is better IMO to test explicitly
for either bfd_link_hash_defined or bfd_link_hash_defweak. I'm left
wondering whether there isn't some case where we get here with an
undefweak (or common, or new, or..) symbol.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list