Fix seg-fault printing assembler statistics when the output file was not created.
authorNick Clifton <nickc@redhat.com>
Thu, 1 Dec 2016 15:02:45 +0000 (15:02 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 1 Dec 2016 15:02:45 +0000 (15:02 +0000)
PR gas/20897
* subsegs.c (subsegs_print_statistics): Do nothing if no output
file was created.

gas/ChangeLog
gas/subsegs.c

index 385ff56c0ed9021e4eb0e04ec20d9ed2bed6fe74..76c23ce70ca53e568f05dd4248d17f3c303e1070 100644 (file)
@@ -1,5 +1,9 @@
 2016-12-01  Nick Clifton  <nickc@redhat.com>
 
+       PR gas/20897
+       * subsegs.c (subsegs_print_statistics): Do nothing if no output
+       file was created.
+
        PR gas/20895
        * symbols.c (resolve_symbol_value): Gracefully handle erroneous
        symbolic expressions.
index 0647653f8784e1d8c9bec2bd248082454ff4b215..ab0836c227840147efdf1903672b09a12fa027ef 100644 (file)
@@ -297,6 +297,10 @@ subsegs_print_statistics (FILE *file)
   frchainS *frchp;
   asection *s;
 
+  /* PR 20897 - check to see if the output bfd was actually created.  */
+  if (stdoutput == NULL)
+    return;
+
   fprintf (file, "frag chains:\n");
   for (s = stdoutput->sections; s; s = s->next)
     {