OPenJDK 24.0.2-ga fails to build with glibc 2.42.

"Maurice van der Stee" ([email protected] via blfs-support Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.beyond.support
Message-ID <[email protected]>
Hi,

The subject sys it all.

Therw is a fix from upsream which I've turned into a patch for x86_64,
atttached.
-- 
=================================================
Maurice van der Stee

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-support
Unsubscribe: See the above information page
OpenJDK-24.0.2-ga-glibc-2.42-fix.patch (text/x-patch, 6 KB)
diff -uNr jdk24u-jdk-24.0.2-ga.orig/src/hotspot/cpu/aarch64/assembler_aarch64.cpp jdk24u-jdk-24.0.2-ga/src/hotspot/cpu/aarch64/assembler_aarch64.cpp
--- jdk24u-jdk-24.0.2-ga.orig/src/hotspot/cpu/aarch64/assembler_aarch64.cpp	2025-08-07 11:21:59.643258747 +0200
+++ jdk24u-jdk-24.0.2-ga/src/hotspot/cpu/aarch64/assembler_aarch64.cpp	2025-08-07 11:21:59.652916062 +0200
@@ -457,7 +457,7 @@
 
 bool asm_util::operand_valid_for_immediate_bits(int64_t imm, unsigned nbits) {
   guarantee(nbits == 8 || nbits == 12, "invalid nbits value");
-  uint64_t uimm = (uint64_t)uabs((jlong)imm);
+  uint64_t uimm = (uint64_t)g_uabs((jlong)imm);
   if (uimm < (UCONST64(1) << nbits))
     return true;
   if (uimm < (UCONST64(1) << (2 * nbits))
diff -uNr jdk24u-jdk-24.0.2-ga.orig/src/hotspot/cpu/aarch64/assembler_aarch64.hpp jdk24u-jdk-24.0.2-ga/src/hotspot/cpu/aarch64/assembler_aarch64.hpp
--- jdk24u-jdk-24.0.2-ga.orig/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	2025-08-07 11:21:59.639265762 +0200
+++ jdk24u-jdk-24.0.2-ga/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	2025-08-07 11:21:59.651426878 +0200
@@ -932,7 +932,7 @@
   static const uint64_t 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)
diff -uNr jdk24u-jdk-24.0.2-ga.orig/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp jdk24u-jdk-24.0.2-ga/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
--- jdk24u-jdk-24.0.2-ga.orig/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	2025-08-07 11:21:59.641471802 +0200
+++ jdk24u-jdk-24.0.2-ga/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	2025-08-07 11:21:59.652171152 +0200
@@ -3271,7 +3271,7 @@
   if (fits) {
     (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 {
diff -uNr jdk24u-jdk-24.0.2-ga.orig/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp jdk24u-jdk-24.0.2-ga/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
--- jdk24u-jdk-24.0.2-ga.orig/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	2025-08-07 11:21:59.644822532 +0200
+++ jdk24u-jdk-24.0.2-ga/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	2025-08-07 11:21:59.653516323 +0200
@@ -1133,7 +1133,7 @@
 
   void copy_memory_small(DecoratorSet decorators, BasicType type, Register s, Register d, Register count, int step) {
     bool is_backwards = step < 0;
-    size_t granularity = uabs(step);
+    size_t granularity = g_uabs(step);
     int direction = is_backwards ? -1 : 1;
 
     Label Lword, Lint, Lshort, Lbyte;
@@ -1192,7 +1192,7 @@
                    Register s, Register d, Register count, int step) {
     copy_direction direction = step < 0 ? copy_backwards : copy_forwards;
     bool is_backwards = step < 0;
-    unsigned int granularity = uabs(step);
+    unsigned int granularity = g_uabs(step);
     const Register t0 = r3, t1 = r4;
 
     // <= 80 (or 96 for SIMD) bytes do inline. Direction doesn't matter because we always
diff -uNr jdk24u-jdk-24.0.2-ga.orig/src/hotspot/share/opto/mulnode.cpp jdk24u-jdk-24.0.2-ga/src/hotspot/share/opto/mulnode.cpp
--- jdk24u-jdk-24.0.2-ga.orig/src/hotspot/share/opto/mulnode.cpp	2025-08-07 11:21:59.634077449 +0200
+++ jdk24u-jdk-24.0.2-ga/src/hotspot/share/opto/mulnode.cpp	2025-08-07 11:21:59.649612247 +0200
@@ -245,7 +245,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;
   }
@@ -480,7 +480,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;
   }
diff -uNr jdk24u-jdk-24.0.2-ga.orig/src/hotspot/share/opto/subnode.cpp jdk24u-jdk-24.0.2-ga/src/hotspot/share/opto/subnode.cpp
--- jdk24u-jdk-24.0.2-ga.orig/src/hotspot/share/opto/subnode.cpp	2025-08-07 11:21:59.631389660 +0200
+++ jdk24u-jdk-24.0.2-ga/src/hotspot/share/opto/subnode.cpp	2025-08-07 11:21:59.648704624 +0200
@@ -1927,14 +1927,14 @@
   case Type::Int: {
     const TypeInt* ti = t1->is_int();
     if (ti->is_con()) {
-      return TypeInt::make(uabs(ti->get_con()));
+      return TypeInt::make(g_uabs(ti->get_con()));
     }
     break;
   }
   case Type::Long: {
     const TypeLong* tl = t1->is_long();
     if (tl->is_con()) {
-      return TypeLong::make(uabs(tl->get_con()));
+      return TypeLong::make(g_uabs(tl->get_con()));
     }
     break;
   }
diff -uNr jdk24u-jdk-24.0.2-ga.orig/src/hotspot/share/utilities/globalDefinitions.hpp jdk24u-jdk-24.0.2-ga/src/hotspot/share/utilities/globalDefinitions.hpp
--- jdk24u-jdk-24.0.2-ga.orig/src/hotspot/share/utilities/globalDefinitions.hpp	2025-08-07 11:21:59.636746545 +0200
+++ jdk24u-jdk-24.0.2-ga/src/hotspot/share/utilities/globalDefinitions.hpp	2025-08-07 11:21:59.650571194 +0200
@@ -1144,7 +1144,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;
@@ -1153,7 +1153,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;
@@ -1162,8 +1162,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 uabs((julong)n); }
+static inline unsigned int g_uabs(int n) { return uabs((unsigned int)n); }
 
 // "to" should be greater than "from."
 inline size_t byte_size(void* from, void* to) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.