jdk8u-dev icon indicating copy to clipboard operation
jdk8u-dev copied to clipboard

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

Open gnu-andrew opened this issue 1 month ago • 4 comments

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, "AArch64: Remove uses of long and unsigned long ints" and JDK-8251930, "AArch64: Native types mismatch in hotspot", but these in turn require adaptation to work around other missing changes like JDK-8222412 "AARCH64: multiple instructions encoding issues" and 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 "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>

Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] JDK-8354941 needs maintainer approval

Issue

  • JDK-8354941: Build failure with glibc 2.42 due to uabs() name collision (Bug - P3)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev.git pull/711/head:pull/711
$ git checkout pull/711

Update a local copy of the PR:
$ git checkout pull/711
$ git pull https://git.openjdk.org/jdk8u-dev.git pull/711/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 711

View PR using the GUI difftool:
$ git pr show -t 711

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/711.diff

Using Webrev

Link to Webrev Comment

gnu-andrew avatar Nov 03 '25 19:11 gnu-andrew

:wave: Welcome back andrew! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

bridgekeeper[bot] avatar Nov 03 '25 19:11 bridgekeeper[bot]

❗ This change is not yet ready to be integrated. See the Progress checklist in the description for automated requirements.

openjdk[bot] avatar Nov 03 '25 19:11 openjdk[bot]

This backport pull request has now been updated with issue from the original commit.

openjdk[bot] avatar Nov 03 '25 19:11 openjdk[bot]

Webrevs

mlbridge[bot] avatar Nov 03 '25 19:11 mlbridge[bot]

It would be good to merge latest master to get cleaner GHA runs.

jerboaa avatar Nov 12 '25 12:11 jerboaa

⚠️ @gnu-andrew This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

openjdk[bot] avatar Nov 12 '25 12:11 openjdk[bot]