RFR: 8354941: Build failure with glibc 2.42 due to uabs() name collision

Andrew Haley aph at openjdk.org
Sun Apr 27 09:38:45 UTC 2025


On Thu, 17 Apr 2025 12:31:18 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

> glibc 2.42 defines its own version of `uabs` when `stdlib.h` is being included. I propose to rename the hotspot version of `uabs` to `custom_uabs` (or some other suitable name) to avoid the name clash. The rename of the function is hidden by using a `UABS` macro instead in the code.
> 
> Testing:
> - [x] GHA (also [here](https://github.com/jerboaa/jdk/actions/runs/14513365723))
> - [x] Builds with this patch with GCC 15 where the build would fail earlier and pass with this patch.
> 
> Thoughts?

I think this is the correct fix.


diff --git a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
index 94f37e7954e..6fa94222d82 100644
--- a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+++ b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
@@ -31,12 +31,15 @@
 // globally used constants & types, class (forward)
 // declarations and a few frequently used utility functions.
 
+#include <stddef.h>
+#undef ISOC2Y_SOURCE
+#undef __GLIBC_USE_ISOC2Y // Too soon
+
 #include <alloca.h>
 #include <ctype.h>
 #include <inttypes.h>
 #include <string.h>
 #include <stdarg.h>
-#include <stddef.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>

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

PR Comment: https://git.openjdk.org/jdk/pull/24723#issuecomment-2833354197


More information about the hotspot-dev mailing list