diff --git a/fix-build-with-clang-19.patch b/fix-build-with-clang-19.patch new file mode 100644 index 0000000000000000000000000000000000000000..488b4aa69b24f3bdbe6e5170c4117f9a2b5c6286 --- /dev/null +++ b/fix-build-with-clang-19.patch @@ -0,0 +1,42 @@ +From eb919d3ebee4d8c9f382fd62305e6af5725c3a23 Mon Sep 17 00:00:00 2001 +From: jchzhou +Date: Wed, 16 Apr 2025 22:59:27 +0800 +Subject: [PATCH] fix build with clang 19 + +Clang 19 is now more strict about undefined integral expressions used as +constants in enum, which results in errors compiling java/openjdk11, +similar to: + + /wrkdirs/usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.24-8-1/src/jdk.pack/share/native/common-unpack/constants.h:206:33: error: expression is not an integral constant expression + 206 | AO_UNUSED_MBZ = (-1)<<13, // options bits reserved for future use. + | ^~~~~~~~ + /wrkdirs/usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.24-8-1/src/jdk.pack/share/native/common-unpack/constants.h:206:37: note: left shift of negative value -1 + 206 | AO_UNUSED_MBZ = (-1)<<13, // options bits reserved for future use. + | ^ + +Replace the negative value with ~0u to fix this error. + +Source: https://cgit.freebsd.org/ports/patch/?id=d2ae63c6feffda05eb643520dd851451ee337f53 +Signed-off-by: Dimitry Andric + +Tested-by: jchzhou o +--- + src/jdk.pack/share/native/common-unpack/constants.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/jdk.pack/share/native/common-unpack/constants.h b/src/jdk.pack/share/native/common-unpack/constants.h +index 8d8376dd2..0bc0e00dc 100644 +--- a/src/jdk.pack/share/native/common-unpack/constants.h ++++ b/src/jdk.pack/share/native/common-unpack/constants.h +@@ -203,7 +203,7 @@ enum { + AO_HAVE_FIELD_FLAGS_HI = 1<<10, + AO_HAVE_METHOD_FLAGS_HI = 1<<11, + AO_HAVE_CODE_FLAGS_HI = 1<<12, +- AO_UNUSED_MBZ = (-1)<<13, // options bits reserved for future use. ++ AO_UNUSED_MBZ = (~0u)<<13, // options bits reserved for future use. + + #define ARCHIVE_BIT_DO(F) \ + F(AO_HAVE_SPECIAL_FORMATS) \ +-- +2.49.0 + diff --git a/openjdk-11.spec b/openjdk-11.spec index 2c687e27989867f5e949dfe9b99b5bf1c5137832..5e08a88c97377e5bf3af1691901004bf1cbf15e4 100644 --- a/openjdk-11.spec +++ b/openjdk-11.spec @@ -95,6 +95,9 @@ # 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]*||') +%if "%{?toolchain}" == "clang" +%global ourflags "$ourflags -Wno-register" +%endif %global ourcppflags %(echo %ourflags | sed -e 's|-fexceptions||') %global ourldflags %{__global_ldflags} @@ -773,7 +776,7 @@ Provides: java-src%{?1} = %{epoch}:%{version}-%{release} Name: java-%{javaver}-%{origin} Version: %{newjavaver}.%{buildver} -Release: 3 +Release: 4 # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons # and this change was brought into RHEL-4. java-1.5.0-ibm packages # also included the epoch in their virtual provides. This created a @@ -912,6 +915,9 @@ Patch94: change-ActivePrcoessorCount-only-for-HBase.patch Patch95: 8347965-tz-Update-Timezone-Data-to-2025a.patch Patch96: add-jbolt-feature.patch +# fix building issues with clang +Patch97: fix-build-with-clang-19.patch + ############################################ # # riscv64 specific patches @@ -1222,6 +1228,7 @@ pushd %{top_level_dir_name} %ifarch sw_64 %patch6000 -p1 %endif +%patch97 -p1 popd # openjdk # Extract systemtap tapsets @@ -1351,6 +1358,9 @@ bash ../configure \ --with-num-cores="$NUM_PROC" \ --disable-javac-server \ --disable-warnings-as-errors \ +%if "%{?toolchain}" == "clang" + --with-toolchain-type=clang \ +%endif # Debug builds don't need same targets as release for # build speed-up @@ -1751,6 +1761,9 @@ cjc.mainProgram(args) -- the returns from copy_jdk_configs.lua should not affect %changelog +* Wed Apr 16 2025 jchzhou - 1:11.0.26.4-4 +- fix building issues with clang + * Tue Apr 1 2025 2025 swcompiler - 1:11.0.26.4-3 - add sw64 port to 11.0.26