RFR(XS): 7175914: Usage of gcc with precompiled headers produces wrong build dependencies
Coleen Phillimore
coleen.phillimore at oracle.com
Mon Jun 11 11:06:48 PDT 2012
Looks good. Thank you again for fixing this!
Coleen
On 6/11/2012 12:32 PM, Volker Simonis wrote:
> Hi,
>
> please review and push this little change which fixes the dependencies for
> gcc builds which use precompiled headers:
>
> http://cr.openjdk.java.net/~simonis/7175914/
>
> Below is some background:
>
> Dependencies which are resolved from the precompiled headers file during
> compilation are not by default listed as dependencies in the dependencies file
> generated by gcc with the '-MMD' option. This leads to incomplete dependencies
> and potentially bogus incremental builds. To fix the problem, we have to
> additionally use the '-fpch-deps' option which instructs gcc to include
> dependencies from the precompiled headers file as well.
>
> Notice that the gcc documentation (at least for gcc 4.1 and 4.4) is imprecise
> with respect to precompiled headers and dependencies genereation. The
> description of the flags for the generation of the dependency-files (-M, -MM,
> -MMD, ..) don't even mention that these flags may be impacted by the use of
> precompiled headers. The description of '-fpch-deps' is wrong in the sense that
> it claims that if it is not set, a dependency for the precompiled header file
> will be generated. This is not true for gcc 4.1 and 4.4. If '-fpch-deps' is not
> set, the generated dependencies file only contains dependencies which are not
> resolved trough the precompiled headers file. If '-fpch-deps' is set, the
> dependencies file contains all the dependencies, some of them even several
> times! While this is not nice and unnecessarily bloats the dependencies files,
> it is at least correct.
>
> Another undocumented pitfall is the fact that the precompiled header file has
> to be prepared with '-M' as well in order to make '-fpch-deps' work. This is at
> least suggested by the gcc bug
> "28483 - Dependency tracking should be on by default when copiling .gchs" [1].
> Fortunately, the command line used by the HotSpot build to create the
> precompiled headers file already contains these parameters, so we don't have to
> do anything in this case.
>
> And there's also another unresolved gcc bug
> "14933 - missing pre-compiled header depends with -MD" [2]
> which seems to be obsoleted by the '-fpch-deps' option but which I
> want to mention
> here for reference.
>
> Regards,
> Volker
>
> [1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28483
> [2] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14933
More information about the hotspot-dev
mailing list