[jdk8u-dev] RFR: 8354941: Build failure with glibc 2.42 due to uabs() name collision
Andrew John Hughes
andrew at openjdk.org
Mon Nov 3 19:33:35 UTC 2025
This backport replaces the local definition of `uabs` with `g_uabs` to avoid a conflict with the `uabs` declared in versions of glibc 2.42 and later.
The patch is mostly clean, with the exception of two conflicts:
1. In `assembler_aarch64.cpp`, the type of `uimm` is `unsigned long` in 8u, rather than `uint64_t`. 8u is missing a sequence of changes, which begins with [JDK-8248414](https://bugs.openjdk.org/browse/JDK-8248414), "AArch64: Remove uses of long and unsigned long ints" and [JDK-8251930](https://bugs.openjdk.org/browse/JDK-8251930), "AArch64: Native types mismatch in hotspot", but these in turn require adaptation to work around other missing changes like [JDK-8222412](https://bugs.openjdk.org/browse/JDK-8222412) "AARCH64: multiple instructions encoding issues" and [JDK-8139043](https://bugs.openjdk.org/browse/JDK-8139043), "aarch64: add support for adler32 intrinsic". Backporting 8248414 & 8251930 may be worthwhile, especially if Windows & Mac AArch64 ports are ever considered for 8u, but really needs to be done by someone with access to AArch64 hardware to verify the changes. I don't think it's necessary just for a simple name substitution.
2. In `stubGenerator_aarch64.cpp`, I corrected the type of `granularity` in `copy_memory(bool, Register, Register, Register, Register, int)` from `int` to `unsigned int`, which matches the signature of `g_uabs`. This same correction was made in later JDKs as part of an enhancement, [JDK-8257436](https://bugs.openjdk.org/browse/JDK-8257436) "Regressions in ArrayCopyUnalignedDst.testByte/testChar for 65-78 bytes when UseSIMDForMemoryOps is on". Again, the rest may be worth backporting if the same performance improvement is visible on 8u AArch64, but the risk isn't appropriate for this change.
The change was verified by ensuring that `uabs` no longer exists in the source code after this patch.
~~~
$ grep -r 'uabs' hotspot/
hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp: return g_uabs(target - branch) < branch_range;
hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp: if (g_uabs(imm) < (1 << 24)) {
hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp: size_t granularity = g_uabs(step);
hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp: unsigned int granularity = g_uabs(step);
hotspot/src/cpu/aarch64/vm/assembler_aarch64.cpp: unsigned long uimm = g_uabs(imm);
hotspot/src/share/vm/opto/mulnode.cpp: unsigned int abs_con = g_uabs(con);
hotspot/src/share/vm/opto/mulnode.cpp: julong abs_con = g_uabs(con);
hotspot/src/share/vm/utilities/globalDefinitions.hpp:static inline unsigned int g_uabs(unsigned int n) {
hotspot/src/share/vm/utilities/globalDefinitions.hpp:static inline julong g_uabs(julong n) {
hotspot/src/share/vm/utilities/globalDefinitions.hpp:static inline julong g_uabs(jlong n) { return g_uabs((julong)n); }
hotspot/src/share/vm/utilities/globalDefinitions.hpp:static inline unsigned int g_uabs(int n) { return g_uabs((unsigned int)n); }
$ grep -r 'uabs' hotspot/|grep -v g_uabs
<no results>
~~~
-------------
Commit messages:
- Backport 26a8acad1f45bec90ad6c4ff5cd41f4e7450a962
Changes: https://git.openjdk.org/jdk8u-dev/pull/711/files
Webrev: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=711&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8354941
Stats: 11 lines in 6 files changed: 0 ins; 0 del; 11 mod
Patch: https://git.openjdk.org/jdk8u-dev/pull/711.diff
Fetch: git fetch https://git.openjdk.org/jdk8u-dev.git pull/711/head:pull/711
PR: https://git.openjdk.org/jdk8u-dev/pull/711
More information about the jdk8u-dev
mailing list