[packages/openjdk12] add patch to fix build with glibc 2.42

atler atler at pld-linux.org
Fri May 1 02:08:15 CEST 2026


commit baf3fc92d73e329089844df20ba0cfdbe62f32cd
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Apr 29 15:01:53 2026 +0200

    add patch to fix build with glibc 2.42

 glibc-2.42.patch | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 openjdk12.spec   |   2 +
 2 files changed, 115 insertions(+)
---
diff --git a/openjdk12.spec b/openjdk12.spec
index aaaec0b..bf18fd9 100644
--- a/openjdk12.spec
+++ b/openjdk12.spec
@@ -36,6 +36,7 @@ Patch0:		no_optflags.patch
 Patch1:		make-4.3.patch
 Patch2:		x32.patch
 Patch3:		aarch64.patch
+Patch4:		glibc-2.42.patch
 URL:		http://openjdk.java.net/
 BuildRequires:	alsa-lib-devel
 BuildRequires:	ant
@@ -348,6 +349,7 @@ Przykłady dla OpenJDK.
 %patch -P1 -p1
 %patch -P2 -p1
 %patch -P3 -p1
+%patch -P4 -p1
 
 %build
 # Make sure we have /proc mounted - otherwise idlc will fail later.
diff --git a/glibc-2.42.patch b/glibc-2.42.patch
new file mode 100644
index 0000000..e9173f2
--- /dev/null
+++ b/glibc-2.42.patch
@@ -0,0 +1,113 @@
+--- jdk12u-jdk-12.0.2-ga/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp.orig	2019-07-16 18:38:28.000000000 +0200
++++ jdk12u-jdk-12.0.2-ga/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	2026-04-29 22:46:25.532201238 +0200
+@@ -2195,7 +2195,7 @@
+   if (operand_valid_for_add_sub_immediate((int)imm)) {
+     (this->*insn1)(Rd, Rn, imm);
+   } else {
+-    if (uabs(imm) < (1 << 24)) {
++    if (g_uabs(imm) < (1 << 24)) {
+        (this->*insn1)(Rd, Rn, imm & -(1 << 12));
+        (this->*insn1)(Rd, Rd, imm & ((1 << 12)-1));
+     } else {
+--- jdk12u-jdk-12.0.2-ga/src/hotspot/cpu/aarch64/assembler_aarch64.cpp.orig	2019-07-16 18:38:28.000000000 +0200
++++ jdk12u-jdk-12.0.2-ga/src/hotspot/cpu/aarch64/assembler_aarch64.cpp	2026-04-29 22:46:58.051256235 +0200
+@@ -1441,7 +1441,7 @@
+ 
+ bool Assembler::operand_valid_for_add_sub_immediate(long imm) {
+   bool shift = false;
+-  unsigned long uimm = uabs(imm);
++  unsigned long uimm = g_uabs(imm);
+   if (uimm < (1 << 12))
+     return true;
+   if (uimm < (1 << 24)
+--- jdk12u-jdk-12.0.2-ga/src/hotspot/cpu/aarch64/assembler_aarch64.hpp.orig	2019-07-16 18:38:28.000000000 +0200
++++ jdk12u-jdk-12.0.2-ga/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	2026-04-29 22:47:22.737205469 +0200
+@@ -555,7 +555,7 @@
+   static bool offset_ok_for_immed(long offset, int shift = 0) {
+     unsigned mask = (1 << shift) - 1;
+     if (offset < 0 || offset & mask) {
+-      return (uabs(offset) < (1 << (20 - 12))); // Unscaled offset
++      return (g_uabs(offset) < (1 << (20 - 12))); // Unscaled offset
+     } else {
+       return ((offset >> shift) < (1 << (21 - 10 + 1))); // Scaled, unsigned offset
+     }
+@@ -835,7 +835,7 @@
+   static const unsigned long branch_range = NOT_DEBUG(128 * M) DEBUG_ONLY(2 * M);
+ 
+   static bool reachable_from_branch_at(address branch, address target) {
+-    return uabs(target - branch) < branch_range;
++    return g_uabs(target - branch) < branch_range;
+   }
+ 
+   // Unconditional branch (immediate)
+--- jdk12u-jdk-12.0.2-ga/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp.orig	2019-07-16 18:38:28.000000000 +0200
++++ jdk12u-jdk-12.0.2-ga/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	2026-04-29 22:47:38.800071951 +0200
+@@ -1038,7 +1038,7 @@
+ 
+   void copy_memory_small(Register s, Register d, Register count, Register tmp, int step) {
+     bool is_backwards = step < 0;
+-    size_t granularity = uabs(step);
++    size_t granularity = g_uabs(step);
+     int direction = is_backwards ? -1 : 1;
+     int unit = wordSize * direction;
+ 
+@@ -1094,7 +1094,7 @@
+                    Register count, Register tmp, int step) {
+     copy_direction direction = step < 0 ? copy_backwards : copy_forwards;
+     bool is_backwards = step < 0;
+-    int granularity = uabs(step);
++    int granularity = g_uabs(step);
+     const Register t0 = r3, t1 = r4;
+ 
+     // <= 96 bytes do inline. Direction doesn't matter because we always
+--- jdk12u-jdk-12.0.2-ga/src/hotspot/share/utilities/globalDefinitions.hpp.orig	2019-07-16 18:38:28.000000000 +0200
++++ jdk12u-jdk-12.0.2-ga/src/hotspot/share/utilities/globalDefinitions.hpp	2026-04-29 22:47:54.746275137 +0200
+@@ -1099,7 +1099,7 @@
+ 
+ // abs methods which cannot overflow and so are well-defined across
+ // the entire domain of integer types.
+-static inline unsigned int uabs(unsigned int n) {
++static inline unsigned int g_uabs(unsigned int n) {
+   union {
+     unsigned int result;
+     int value;
+@@ -1108,7 +1108,7 @@
+   if (value < 0) result = 0-result;
+   return result;
+ }
+-static inline julong uabs(julong n) {
++static inline julong g_uabs(julong n) {
+   union {
+     julong result;
+     jlong value;
+@@ -1117,8 +1117,8 @@
+   if (value < 0) result = 0-result;
+   return result;
+ }
+-static inline julong uabs(jlong n) { return uabs((julong)n); }
+-static inline unsigned int uabs(int n) { return uabs((unsigned int)n); }
++static inline julong g_uabs(jlong n) { return g_uabs((julong)n); }
++static inline unsigned int g_uabs(int n) { return g_uabs((unsigned int)n); }
+ 
+ // "to" should be greater than "from."
+ inline intx byte_size(void* from, void* to) {
+--- jdk12u-jdk-12.0.2-ga/src/hotspot/share/opto/mulnode.cpp.orig	2019-07-16 18:38:28.000000000 +0200
++++ jdk12u-jdk-12.0.2-ga/src/hotspot/share/opto/mulnode.cpp	2026-04-29 22:48:11.002469294 +0200
+@@ -190,7 +190,7 @@
+   // Check for negative constant; if so negate the final result
+   bool sign_flip = false;
+ 
+-  unsigned int abs_con = uabs(con);
++  unsigned int abs_con = g_uabs(con);
+   if (abs_con != (unsigned int)con) {
+     sign_flip = true;
+   }
+@@ -286,7 +286,7 @@
+ 
+   // Check for negative constant; if so negate the final result
+   bool sign_flip = false;
+-  julong abs_con = uabs(con);
++  julong abs_con = g_uabs(con);
+   if (abs_con != (julong)con) {
+     sign_flip = true;
+   }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/openjdk12.git/commitdiff/bee864ac914c0e383dfe281d229ac707d7b03f43



More information about the pld-cvs-commit mailing list