OpenJDK 11 misuses the low bits in pointers that have an assumed
alignment. This is undefined behavior and compiler optimizations break
the code at runtime, causing SIGSEGV in the garbage collector.
This was originally noticed for clang13, but GCC15 seems to
do similar optimizations now. The UB was removed in JDK14.
See https://bugs.openjdk.org/browse/JDK-8229258
This is a smaller version of the unsuccessful backport PR proposed upstream:
https://github.com/openjdk/jdk11u-dev/pull/1284
Removed the .github/workflows changes and everything from the markOop to
markWord rename and file move from the patch. I found a way to avoid most
of the `markOopDesc`->`markOop` renames with a typedef, and dropped the
changes to all architectures besides x86 and aarch64.
Fixes: https://github.com/nixos/nixpkgs/issues/526834
- add "-std=gnu17" to `env.NIX_CFLAGS_COMPILE` for `openjdk8` and `openjdk11`
Similar to what archlinux and gentoo did:
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65ea75ab7b558c1a7471eaf9ab542cee66631ea5e2b65f230b87ced23f8b
Fixes build failure of `openjdk8` with gcc15:
```
In file included from /build/source/hotspot/agent/src/os/linux/libproc_impl.h:30,
from /build/source/hotspot/agent/src/os/linux/salibelf.h:30,
from /build/source/hotspot/agent/src/os/linux/salibelf.c:25:
/build/source/hotspot/agent/src/os/linux/libproc.h:86:13: error: 'bool'
cannot be defined via 'typedef'
86 | typedef int bool;
| ^~~~
/build/source/hotspot/agent/src/os/linux/libproc.h:86:13: note: 'bool'
is a keyword with '-std=c23' onwards
```
Fixes build failure of `openjdk11` with gcc15:
```
/build/source/src/java.base/unix/native/libnet/DefaultProxySelector.c:
In function 'getProxyByGProxyResolver':
/build/source/src/java.base/unix/native/libnet/DefaultProxySelector.c:389:16:
error: too many arguments to function 'g_proxy_resolver_lookup'; expected 0, have 4
389 | proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error);
| ~^~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
/build/source/src/java.base/unix/native/libnet/DefaultProxySelector.c:408:34:
error: too many arguments to function 'g_network_address_parse_uri'; expected 0, have 3
408 | (*g_network_address_parse_uri)(proxies[i], 0,
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
```
`eclipse/updates/4.30/R-4.30-202312010110/plugins/org.eclipse.swt.gtk.linux.aarch64_3.124.200.v20231113-1355` has been manually added in deps.json,
as our gradle dependency lockfile generator currently cannot handle platform
specific dependencies like this one.
In some cases, NIX_SSL_CERT_FILE may point to variation of cacerts,
see https://github.com/NixOS/nixpkgs/issues/435467 for examples.
`keytool` is not happy with all certs in there, and requires some
special care.
Re-use the tooling we have to populate openjdk 8 with its
trust store, instead of our naïve approach.
The nixpkgs linter doesn't allow us to simply refer to the .pl file from
inside the openjdk directory, and re-exposing it only from the openjdk8
derivation as a passthru is also a bit annoying.
As suggested in PR review, expose the perl script via pkgs and use it
both for build-maven-package and the openjdk8 build.
Fixes#435467.
`jdk8` cross still broken
Using `__spliced.depsBuildBuild` to reduce rebuilds/space usage because it does not seem to matter if
it's that or `buildHost`
`depsBuildBuild` `configure: error: Could not find required tool for BUILD_CC`
`zlib` in `nativeBuildInputs`
```
/build/source/src/java.base/share/native/libzip/Adler32.c:33:10: fatal error: zlib.h: No such file or directory
33 | #include <zlib.h>
| ^~~~~~~~
compilation terminated.
make[4]: *** [lib/CoreLibraries.gmk:88: /build/source/build/linux-aarch64-server-release/buildjdk/support/native/java.base/libzip/Adler32.o] Error 1
make[4]: *** Waiting for unfinished jobs....
/build/source/src/java.base/share/native/libzip/CRC32.c:32:10: fatal error: zlib.h: No such file or directory
32 | #include <zlib.h>
| ^~~~~~~~
compilation terminated.
/build/source/src/java.base/share/native/libzip/Deflater.c:35:10: fatal error: zlib.h: No such file or directory
35 | #include <zlib.h>
| ^~~~~~~~
compilation terminated.
make[4]: *** [lib/CoreLibraries.gmk:88: /build/source/build/linux-aarch64-server-release/buildjdk/support/native/java.base/libzip/CRC32.o] Error 1
make[4]: *** [lib/CoreLibraries.gmk:88: /build/source/build/linux-aarch64-server-release/buildjdk/support/native/java.base/libzip/Deflater.o] Error 1
make[3]: *** [Main.gmk:191: java.base-libs] Error 2
make[2]: *** [make/Main.gmk:589: create-buildjdk-interim-image] Error 2
make[2]: *** Waiting for unfinished jobs....
ERROR: Build failed for target 'images' in configuration 'linux-aarch64-server-release' (exit code 2)
Stopping javac server
```