RFR: 8354941: Build failure with glibc 2.42 due to uabs() name collision
Kim Barrett
kbarrett at openjdk.org
Mon Apr 21 16:44:55 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?
HotSpot uabs was added to support C2 constant folding, e.g. providing Java
integer arithmetic semantics. We have since added a number of functions
specifically for that purpose, e.g. java_add &etc. Renaming the function used
for that purpose to java_abs seems like it would be better.
Of the other uses of HotSpot uabs, many look suspect to me, and also don't
fall into the category of needing to implement Java integer arithmetic
semantcs, e.g. they shouldn't be using a java_xxx function. I haven't looked
at them carefully, but on an initial look at least some appear to fall into
the category of "bug that isn't fixed by wrap semantics".
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24723#issuecomment-2818990122
More information about the hotspot-dev
mailing list