This is the mail archive of the binutils@sourceware.org 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] s390x/BFD: Don't crash on discarded GOT


Hi,

 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  <macro@linux-mips.org>

	bfd/
	* elf64-s390.c (elf_s390_finish_dynamic_sections): Don't set GOT's
	entry size if there is no ELF section data.

  Maciej

binutils-2.23.52-20130506-s390x-finish-dynamic.patch
Index: binutils/bfd/elf64-s390.c
===================================================================
--- binutils.orig/bfd/elf64-s390.c
+++ binutils/bfd/elf64-s390.c
@@ -3619,8 +3619,9 @@ elf_s390_finish_dynamic_sections (bfd *o
 		       - htab->elf.splt->output_section->vma - 6)/2,
 		      htab->elf.splt->contents + 8);
 	}
-      elf_section_data (htab->elf.splt->output_section)
-	->this_hdr.sh_entsize = PLT_ENTRY_SIZE;
+      if (elf_section_data (htab->elf.splt->output_section) != NULL)
+	elf_section_data (htab->elf.splt->output_section)->this_hdr.sh_entsize
+	  = PLT_ENTRY_SIZE;
     }
 
   if (htab->elf.sgotplt)


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