This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] SPARC/BFD: Don't crash on discarded GOT


 This change fixes a linker crash where GOT is produced but not copied to 
output, e.g. because of the .got.plt input section being discarded through 
the /DISCARD/ linker script keyword -- not a particularly useful use case, 
but the linker shouldn't crash regardless.

 OK to apply?

2013-07-27  Maciej W. Rozycki  <>

	* elf32-sparc.c (_bfd_sparc_elf_finish_dynamic_sections): Don't 
	set GOT's entry size if there is no ELF section data.


Index: binutils/bfd/elfxx-sparc.c
--- binutils.orig/bfd/elfxx-sparc.c
+++ binutils/bfd/elfxx-sparc.c
@@ -4793,9 +4793,10 @@ _bfd_sparc_elf_finish_dynamic_sections (
-      elf_section_data (splt->output_section)->this_hdr.sh_entsize
-	= (htab->is_vxworks || !ABI_64_P (output_bfd))
-	  ? 0 : htab->plt_entry_size;
+      if (elf_section_data (splt->output_section) != NULL)
+        elf_section_data (splt->output_section)->this_hdr.sh_entsize
+          = ((htab->is_vxworks || !ABI_64_P (output_bfd))
+             ? 0 : htab->plt_entry_size);
   /* Set the first entry in the global offset table to the address of

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]