From 2ac865acf01270240fecfb27180e65fc55513d83 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 27 Aug 2020 12:50:20 +0930 Subject: [PATCH] arm-symbianelf segfault Yes, the target is marked obsolete due to this and other segfaults, but this one is easy enough to fix. * elf32-arm.c (elf32_arm_final_link_relocate): Don't segfault on sym_sec not being output. --- bfd/ChangeLog | 5 +++++ bfd/elf32-arm.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fb998c24986..18ded261a57 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-08-27 Alan Modra + + * elf32-arm.c (elf32_arm_final_link_relocate): Don't segfault + on sym_sec not being output. + 2020-08-27 Alan Modra PR 26416 diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 8fec76e4e1d..24991898f70 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -10595,7 +10595,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, osec = sym_sec->output_section; else osec = input_section->output_section; - symbol = elf_section_data (osec)->dynindx; + symbol = 0; + if (osec && elf_section_data (osec)) + symbol = elf_section_data (osec)->dynindx; if (symbol == 0) { struct elf_link_hash_table *htab = elf_hash_table (info); -- 2.30.2