On Tue, 21 Jan 2025 12:03:14 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:

>> When building with link time optimization (lto) , configure flag is 
>> --enable-jvm-feature-link-time-opt , we run in the gtest build into a lot of 
>> errors.
>> One workaround is just to configure without gtest ; this one changes the 
>> make to NOT use the lto build flags for gtest , just for the "normal" 
>> libjvm.so .
>
> I was thinking maybe you can do something along these lines instead:
> 
> 
> diff --git a/make/hotspot/lib/CompileLibraries.gmk 
> b/make/hotspot/lib/CompileLibraries.gmk
> index e5e04749c44..194530a0b29 100644
> --- a/make/hotspot/lib/CompileLibraries.gmk
> +++ b/make/hotspot/lib/CompileLibraries.gmk
> @@ -33,6 +33,8 @@ include lib/CompileJvm.gmk
>  
>  ifneq ($(GTEST_FRAMEWORK_SRC), )
>    ifneq ($(CREATING_BUILDJDK), true)
> +    # Gtest does not work with LTO
> +    $(JVM_FEATURES_$(JVM_VARIANT)) := $(filter-out link-time-opt, 
> $(JVM_FEATURES_$(JVM_VARIANT)))
>      include lib/CompileGtest.gmk
>    endif
>  endif
> 
> 
> (untested code)

Hi  @magicus , this idea looks nice, I tried it but does not work.
The `JVM_CFLAGS_FEATURES / JVM_LDFLAGS_FEATURES`  are still set and go into the 
gtest build.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23173#issuecomment-2605049578

Reply via email to