From 56758378c208df8a596102eac9ef57c686717cae Mon Sep 17 00:00:00 2001 From: Andrew Hughes Date: Thu, 4 Dec 2025 18:15:43 +0000 Subject: [PATCH] Remove OpenJDK compiler flag filters and use build_{c,ld}flags directly Related: RHEL-133763 --- java-25-openjdk.spec | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/java-25-openjdk.spec b/java-25-openjdk.spec index ce29341..9355c17 100644 --- a/java-25-openjdk.spec +++ b/java-25-openjdk.spec @@ -213,15 +213,6 @@ %global debugedit %{_rpmconfigdir}/debugedit %endif -# Filter out flags from the optflags macro that cause problems with the OpenJDK build -# We filter out -O flags so that the optimization of HotSpot is not lowered from O3 to O2 -# We filter out -Wall which will otherwise cause HotSpot to produce hundreds of thousands of warnings (100+mb logs) -# We replace it with -Wformat (required by -Werror=format-security) and -Wno-cpp to avoid FORTIFY_SOURCE warnings -# We filter out -fexceptions as the HotSpot build explicitly does -fno-exceptions and it's otherwise the default for C++ -%global ourflags %(echo %optflags | sed -e 's|-Wall|-Wformat -Wno-cpp|' | sed -r -e 's|-O[0-9]*||') -%global ourcppflags %(echo %ourflags | sed -e 's|-fexceptions||') -%global ourldflags %{__global_ldflags} - # In some cases, the arch used by the JDK does # not match _arch. # Also, in some cases, the machine name used by SystemTap @@ -2040,16 +2031,16 @@ for suffix in %{build_loop} ; do if [ "x$suffix" = "x" ] ; then jdkzip=%{releasezip} staticlibzip=%{staticlibzip} - make -C %{nssadapter_name} CFLAGS="%{ourflags}" LDFLAGS="%{ourldflags}" + make -C %{nssadapter_name} CFLAGS="%{build_cflags}" LDFLAGS="%{build_ldflags}" elif [ "x$suffix" = "x%{fastdebug_suffix_unquoted}" ] ; then jdkzip=%{fastdebugzip} staticlibzip=%{fastdebugstaticlibzip} - make -C %{nssadapter_name} CFLAGS="%{ourflags}" LDFLAGS="%{ourldflags}" + make -C %{nssadapter_name} CFLAGS="%{build_cflags}" LDFLAGS="%{build_ldflags}" else # slowdebug jdkzip=%{slowdebugzip} staticlibzip=%{slowdebugstaticlibzip} # Disable _FORTIFY_SOURCE to allow for no optimization - make -C %{nssadapter_name} CFLAGS="%{ourflags} -O0 -Wp,-U_FORTIFY_SOURCE" LDFLAGS="%{ourldflags}" + make -C %{nssadapter_name} CFLAGS="%{build_cflags} -O0 -Wp,-U_FORTIFY_SOURCE" LDFLAGS="%{build_ldflags}" fi installdir=%{installoutputdir -- ${suffix}} @@ -2642,6 +2633,7 @@ exit 0 - Remove redundant (and now outdated) build targets, jdkimage and static_libs_image - Pass ourflags and ourldflags into the nssadapter build using CFLAGS & LDFLAGS - Patch the nssadapter build to recognise LDFLAGS +- Remove OpenJDK compiler flag filters and use build_{c,ld}flags directly - Resolves: RHEL-133733 - Resolves: RHEL-133735 - Resolves: RHEL-133763