Fix seg-fault when running garbage collection on coff binaries.
authorNick Clifton <nickc@redhat.com>
Wed, 27 Jul 2016 09:49:32 +0000 (10:49 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 27 Jul 2016 09:50:52 +0000 (10:50 +0100)
PR ld/20401
* coffgen.c (fini_reloc_cookie_rels): Check for the extistence
of the coff_section_data before using it.

bfd/ChangeLog
bfd/coffgen.c

index 077917801b1c4fc143b164d0c4ea20180b1d22c1..ba48136a547b232e92b377c84323be9767e77275 100644 (file)
@@ -1,3 +1,10 @@
+2016-07-27  Ozkan Sezer  <sezeroz@gmail.com>
+           Nick Clifton  <nickc@redhat.com>
+
+       PR ld/20401
+       * coffgen.c (fini_reloc_cookie_rels): Check for the extistence
+       of the coff_section_data before using it.
+
 2016-07-26  Maciej W. Rozycki  <macro@imgtec.com>
 
        * elfxx-mips.c (mips_elf_calculate_relocation): Handle branches
index 56864cacb2c14a0c003d61d5200a5fc76045718a..75512fbd7d16c5f3111588139e549f4c5e30f6a6 100644 (file)
@@ -2691,7 +2691,13 @@ static void
 fini_reloc_cookie_rels (struct coff_reloc_cookie *cookie,
                        asection *sec)
 {
-  if (cookie->rels && coff_section_data (NULL, sec)->relocs != cookie->rels)
+  if (cookie->rels
+      /* PR 20401.  The relocs may not have been cached, so check first.
+        If the relocs were loaded by init_reloc_cookie_rels() then this
+        will be the case.  FIXME: Would performance be improved if the
+        relocs *were* cached ?  */
+      && coff_section_data (NULL, sec)
+      && coff_section_data (NULL, sec)->relocs != cookie->rels)
     free (cookie->rels);
 }
 
This page took 0.029848 seconds and 4 git commands to generate.