[binutils-gdb] arm-symbianelf segfault

Alan Modra amodra@sourceware.org
Thu Aug 27 12:36:16 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2ac865acf01270240fecfb27180e65fc55513d83

commit 2ac865acf01270240fecfb27180e65fc55513d83
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Aug 27 12:50:20 2020 +0930

    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.

Diff:
---
 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  <amodra@gmail.com>
+
+	* elf32-arm.c (elf32_arm_final_link_relocate): Don't segfault
+	on sym_sec not being output.
+
 2020-08-27  Alan Modra  <amodra@gmail.com>
 
 	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);


More information about the Binutils-cvs mailing list