eec2ffa
diff -up firefox-65.0/build/moz.configure/toolchain.configure.1516081 firefox-65.0/build/moz.configure/toolchain.configure
eec2ffa
--- firefox-65.0/build/moz.configure/toolchain.configure.1516081	2019-01-24 19:48:38.000000000 +0100
eec2ffa
+++ firefox-65.0/build/moz.configure/toolchain.configure	2019-01-28 14:09:00.813320242 +0100
eec2ffa
@@ -1364,7 +1364,7 @@ def pgo_flags(compiler, build_env, targe
8fe69a3
 
8fe69a3
     if compiler.type == 'gcc':
8fe69a3
         return namespace(
8fe69a3
-            gen_cflags=['-fprofile-generate'],
8fe69a3
+            gen_cflags=['-fprofile-generate', '-DMOZ_PROFILE_INSTRUMENTATION'],
8fe69a3
             gen_ldflags=['-fprofile-generate'],
8fe69a3
             use_cflags=['-fprofile-use', '-fprofile-correction',
8fe69a3
                         '-Wcoverage-mismatch'],
eec2ffa
@@ -1385,7 +1385,8 @@ def pgo_flags(compiler, build_env, targe
8fe69a3
 
8fe69a3
         if gen_ldflags:
8fe69a3
             return namespace(
8fe69a3
-                gen_cflags=['-fprofile-instr-generate'],
8fe69a3
+                gen_cflags=['-fprofile-instr-generate',
8fe69a3
+			    '-DMOZ_PROFILE_INSTRUMENTATION'],
8fe69a3
                 gen_ldflags=gen_ldflags,
8fe69a3
                 use_cflags=['-fprofile-instr-use=%s' % profdata,
8fe69a3
                             '-Wno-error=profile-instr-out-of-date',
eec2ffa
diff -up firefox-65.0/toolkit/components/terminator/nsTerminator.cpp.1516081 firefox-65.0/toolkit/components/terminator/nsTerminator.cpp
eec2ffa
--- firefox-65.0/toolkit/components/terminator/nsTerminator.cpp.1516081	2019-01-28 14:09:00.813320242 +0100
eec2ffa
+++ firefox-65.0/toolkit/components/terminator/nsTerminator.cpp	2019-01-28 14:11:56.745577302 +0100
eec2ffa
@@ -419,6 +419,12 @@ void nsTerminator::StartWatchdog() {
8fe69a3
     }
8fe69a3
   }
eec2ffa
 #endif
8fe69a3
+  // Disable watchdog for PGO train builds - writting profile information at
8fe69a3
+  // exit may take time and it is better to make build hang rather than
8fe69a3
+  // silently produce poorly performing binary.
8fe69a3
+#ifdef MOZ_PROFILE_INSTRUMENTATION
8fe69a3
+  crashAfterMS = INT32_MAX;
8fe69a3
+#endif
8fe69a3
 
8fe69a3
   UniquePtr<Options> options(new Options());
8fe69a3
   const PRIntervalTime ticksDuration = PR_MillisecondsToInterval(1000);