This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] VAX/BFD: Don't crash on discarded GOT
- From: "Maciej W. Rozycki" <macro at linux-mips dot org>
- To: binutils at sourceware dot org
- Cc: Matt Thomas <matt at netbsd dot org>, Jan-Benedict Glaw <jbglaw at lug-owl dot de>
- Date: Mon, 20 May 2013 03:40:05 +0100 (BST)
- Subject: [PATCH] VAX/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-05-20 Maciej W. Rozycki <macro@linux-mips.org>
bfd/
* elf32-vax.c (elf_vax_finish_dynamic_sections): Don't set GOT's
entry size if there is no ELF section data.
Maciej
binutils-2.23.52-20130506-vax-finish-dynamic.patch
Index: binutils/bfd/elf32-vax.c
===================================================================
--- binutils.orig/bfd/elf32-vax.c
+++ binutils/bfd/elf32-vax.c
@@ -1989,7 +1989,8 @@ elf_vax_finish_dynamic_sections (bfd *ou
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + 8);
}
- elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
+ if (elf_section_data (sgot->output_section) != NULL)
+ elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
return TRUE;
}