OpenJDK 7 Zero built for AArch64
Matthias Klose
doko at ubuntu.com
Thu Aug 15 12:25:10 PDT 2013
After three weeks build time, I have now OpenJDK 7 Zero packages available for
AArch64. The AArch64 support announced in IcedTea 2.3.10 turned out to be
non-working, so I'm wondering who was able to get a working build for AArch64
using this release.
Binary packages are available from
deb http://people.canonical.com/~doko/tmp/openjdk-aarch64 ./
I did need the following three patches to get it building.
- hotspot-fork.diff, found at
http://mail.openjdk.java.net/pipermail/porters-dev/2013-March/000469.html
While the patch might not be generic enough it is needed for AArch64
because __NR_fork and __NR_execve are not defined, at least when using
glibc 2.17 and kernel headers 3.10.
- jdk-zero-arch.diff, not found anywhere, sets ARCH_DATA_MODEL and
ZERO_ENDIANNESS correctly for AArch64.
- aarch64-detection.diff, only needed for Debian/Ubuntu based builds.
Correctly using the host and not the build macros, and translating
arm64 to aarch64. Unfortunately Debian calls this port arm64 and
not aarch64.
All three patches attached.
The build is a native build using gcj 4.8 from the 4.8 fsf branch for the stage1
build. No tests were run except using the stage1 build to build stage2.
Matthias
-------------- next part --------------
--- openjdk/jdk/make/common/shared/Platform.gmk.orig 2013-08-06 11:33:35.584904685 +0000
+++ openjdk/jdk/make/common/shared/Platform.gmk 2013-08-06 11:35:41.365862699 +0000
@@ -161,7 +161,7 @@
mach := $(shell uname -m)
endif
ifneq (,$(wildcard /usr/bin/dpkg-architecture))
- mach := $(shell (dpkg-architecture -qDEB_BUILD_ARCH_CPU 2>/dev/null || echo $(mach)) | sed 's/powerpc$$/ppc/;s/hppa/parisc/')
+ mach := $(shell (dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null || echo $(mach)) | sed 's/arm64/aarch64/;s/powerpc$$/ppc/;s/hppa/parisc/')
endif
archExpr = case "$(mach)" in \
i[3-9]86) \
--- openjdk/corba/make/common/shared/Platform.gmk.orig 2013-08-06 11:42:29.816950930 +0000
+++ openjdk/corba/make/common/shared/Platform.gmk 2013-08-06 11:42:34.945000504 +0000
@@ -154,7 +154,7 @@
# Arch and OS name/version
mach := $(shell uname -m)
ifneq (,$(wildcard /usr/bin/dpkg-architecture))
- mach := $(shell (dpkg-architecture -qDEB_BUILD_ARCH_CPU 2>/dev/null || echo $(mach)) | sed 's/powerpc$$/ppc/;s/hppa/parisc/')
+ mach := $(shell (dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null || echo $(mach)) | sed 's/arm64/aarch64/;s/powerpc$$/ppc/;s/hppa/parisc/')
endif
archExpr = case "$(mach)" in \
i[3-9]86) \
-------------- next part --------------
--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp
@@ -5374,14 +5374,6 @@ void Parker::unpark() {
extern char** environ;
-#ifndef __NR_fork
-#define __NR_fork IA32_ONLY(2) IA64_ONLY(not defined) AMD64_ONLY(57)
-#endif
-
-#ifndef __NR_execve
-#define __NR_execve IA32_ONLY(11) IA64_ONLY(1033) AMD64_ONLY(59)
-#endif
-
// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
@@ -5392,10 +5384,11 @@ int os::fork_and_exec(char* cmd) {
// fork() in LinuxThreads/NPTL is not async-safe. It needs to run
// pthread_atfork handlers and reset pthread library. All we need is a
// separate process to execve. Make a direct syscall to fork process.
- // On IA64 there's no fork syscall, we have to use fork() and hope for
- // the best...
- pid_t pid = NOT_IA64(syscall(__NR_fork);)
- IA64_ONLY(fork();)
+#ifdef SYS_fork
+ pid_t pid = syscall(SYS_fork);
+#else
+ pid_t pid = syscall(SYS_clone, SIGCHLD, 0, 0, 0, 0);
+#endif
if (pid < 0) {
// fork failed
@@ -5409,10 +5402,7 @@ int os::fork_and_exec(char* cmd) {
// not reset by fork() (see notes above), execve() will instead kill
// every thread in the parent process. We know this is the only thread
// in the new process, so make a system call directly.
- // IA64 should use normal execve() from glibc to match the glibc fork()
- // above.
- NOT_IA64(syscall(__NR_execve, "/bin/sh", argv, environ);)
- IA64_ONLY(execve("/bin/sh", (char* const*)argv, environ);)
+ syscall(SYS_execve, "/bin/sh", argv, environ);
// execve failed
_exit(-1);
-------------- next part --------------
--- openjdk/jdk/make/jdk_generic_profile.sh~ 2013-07-25 18:10:09.000000000 +0200
+++ openjdk/jdk/make/jdk_generic_profile.sh 2013-08-05 02:56:33.016845707 +0200
@@ -269,7 +269,7 @@
i386|ppc|s390|sparc|arm|sh)
ARCH_DATA_MODEL=32
;;
- amd64|ppc64|s390x|sparcv9|ia64|alpha)
+ aarch64|amd64|ppc64|s390x|sparcv9|ia64|alpha)
ARCH_DATA_MODEL=64
;;
*)
@@ -280,7 +280,7 @@
# ZERO_ENDIANNESS is the endianness of the processor
case "${ZERO_LIBARCH}" in
- i386|amd64|ia64|arm)
+ i386|amd64|ia64|arm|aarch64|mipsel)
ZERO_ENDIANNESS=little
;;
ppc*|s390*|sparc*|alpha)
@@ -307,7 +307,7 @@
s390)
ZERO_ARCHFLAG="-m31"
;;
- arm)
+ arm|aarch64)
ZERO_ARCHFLAG="-D_LITTLE_ENDIAN"
;;
*)
More information about the distro-pkg-dev
mailing list