This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Fix PR13468 -z text segfault
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sat, 3 Dec 2011 20:53:25 +1030
- Subject: Fix PR13468 -z text segfault
Applying mainline and branch.
PR ld/13468
* elflink.c (bfd_elf_final_link): Don't segfault when checking
for DT_TEXTREL and .dynamic does not exist.
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.430
diff -u -p -r1.430 elflink.c
--- bfd/elflink.c 15 Nov 2011 11:33:57 -0000 1.430
+++ bfd/elflink.c 3 Dec 2011 04:39:17 -0000
@@ -11188,15 +11188,12 @@ bfd_elf_final_link (bfd *abfd, struct bf
goto error_return;
/* Check for DT_TEXTREL (late, in case the backend removes it). */
- if ((info->warn_shared_textrel && info->shared)
- || info->error_textrel)
+ if (((info->warn_shared_textrel && info->shared)
+ || info->error_textrel)
+ && (o = bfd_get_section_by_name (dynobj, ".dynamic")) != NULL)
{
bfd_byte *dyncon, *dynconend;
- /* Fix up .dynamic entries. */
- o = bfd_get_section_by_name (dynobj, ".dynamic");
- BFD_ASSERT (o != NULL);
-
dyncon = o->contents;
dynconend = o->contents + o->size;
for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
--
Alan Modra
Australia Development Lab, IBM