On Tue, 4 Feb 2025 15:35:03 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:
> When using the configure flag --enable-jvm-feature-opt-size (linux x86_64 opt > build, gcc 11 devkit) we run into this error after the recent PCH related > changes : > > > cc1plus: error: > /build_optsize/hotspot/variant-server/libjvm/objs/precompiled/precompiled.hpp.gch: > not used because `__OPTIMIZE_SIZE__' not defined [-Werror=invalid-pch] > > + exit 1 > gmake[3]: *** [lib/CompileJvm.gmk:170: > /build_optsize/hotspot/variant-server/libjvm/objs/allocation.o] Error 1 > > > Please note that allocation.cpp is currently in the list of `OPT_SPEED_SRC` > files (means - files to be optimized for speed even in case of SIZE > optimization) : > https://github.com/openjdk/jdk/blob/master/make/hotspot/lib/JvmFeatures.gmk#L196 > > Same issue can be observed on Windows x86_64 (VS2022 used). Just to repeat the essence of something made clear in the JBS issue, if we compile a file with different flags compared to the PCH file (precompiled.hpp) then we have to disable PCH for those files as PCH requires that the "same"** flags have to be used. So the old code has been incorrect in that regard. ** gcc has some specific rules about some flags that must match (e.g. -m ) but it somewhat hedges its bets on whether other flags, like optimization flags, need to be the exactly the same. So much easier for us to say they must be the same and so any files for which the flags are customized are excluded from PCH. ------------- PR Comment: https://git.openjdk.org/jdk/pull/23442#issuecomment-2635641583