- if (fwrite (&h, sizeof (struct old_raw_phdr), 1, ofp) != 1)
+ padsize = 0;
+ switch (gmon_get_ptr_size ())
+ {
+ case ptr_32bit:
+ hdrsize = GMON_HDRSIZE_OLDBSD_32;
+ break;
+
+ case ptr_64bit:
+ hdrsize = GMON_HDRSIZE_OLDBSD_64;
+ /* FIXME: Checking host compiler defines here means that we can't
+ use a cross gprof alpha OSF. */
+#if defined(__alpha__) && defined (__osf__)
+ padsize = 4;
+#endif
+ break;
+ }
+ }
+
+ /* Write the parts of the headers that are common to both the
+ old BSD and 4.4BSD formats. */
+ if (gmon_io_write_vma (ofp, histograms->lowpc)
+ || gmon_io_write_vma (ofp, histograms->highpc)
+ || gmon_io_write_32 (ofp, histograms->num_bins
+ * sizeof (UNIT) + hdrsize))
+ {
+ perror (filename);
+ done (1);
+ }
+
+ /* Write out the 4.4BSD header bits, if that's what we're using. */
+ if (file_format == FF_BSD44
+ || hz != hertz())
+ {
+ if (gmon_io_write_32 (ofp, GMONVERSION)
+ || gmon_io_write_32 (ofp, (unsigned int) hz))