On 24/01/2019 1:51 pm, Ao Qi wrote:
Hi David,
On Thu, Jan 24, 2019 at 10:47 AM David Holmes <david.hol...@oracle.com> wrote:
Hi Leslie,
I'm not Erik :) however ....
On 24/01/2019 12:28 pm, Leslie Zhai wrote:
Hi Erik,
Because the flags' macro of MIPS is different from other targets[1], it
will effect the `UnixConstants` of
src/java.base/unix/classes/sun/nio/fs/UnixConstants.java.template, for
example, PREFIX_O_APPEND, so the `Flags` in `FileChannel` is different
from other targets. Then failed[2] to cross compiling jdk12 for
mips64el-linux-gnu target by following the document[3].
It's been quite a while since we built for a platform where the flags
had different values, but it is supposed to work. I suspect that the way
we build now with the module system may not be quite correct in this
regard - but that is just supposition on my part. Because compile-time
constants are stored directly into class files that use them, we have to
generate UnixConstants.java before compiling any class that needs to use
it, then we must compile all classes that do use it. Those classes must
only be executed in conjunction with a tool executing on the target
platform (javac, jmod etc). My suspicion is that we may be executing a
tool on the build platform using the newly compiled classes for the
target platform - and that would be wrong.
Yes. Some variables in UnixConstants.java is defined according to the
target (fcntl.h of mips in this case), but would be executed on host
(x86 in this case) during "make images". These variables of ppc64le,
aarch64 and s390x are the same as x86, but the ones of mips are not.
However, mips is not an official supported target and I did not find
other targets have similar issue, I am not sure if this is a bug or if
this is the right mailing list :)
This is the right mailing list to discuss. :)
So I went back to find when this happened in the past and I
mis-remembered how we solved it. We previously had a problem with the
Oracle Java SE Embedded PPC port where some Linux PPC-e500v2 platforms
defined a different value for the O_NOFOLLOW and O_DIRECT flags. The
solution then was to commit a platform specific version of
UnixConstants.java and change the build system to only use the template
file if there was not a pre-existing .java file. But that platform and
the SE Embedded support was all removed. (SocketOptions.java had a
similar problem.) Further that build logic is completely different to
what we had back then (JDK 6/7).
This is definitely a bug in our build logic IMHO as we specifically use
the build platform c-pre-processor to process the template file based on
the target header files, but then use the resulting class when running
tools on the build platform. This was not something that happened in 6/7
or even 8 and I think the module system tools are where the issue now lies.
I think Erik and/or Magnus will have to give advice on how this may be
properly fixed. I can't see any simple solution.
David
-----
For example:
jdk/build$ find . -name UnixConstants.java | xargs grep -A2 O_APPEND
./linux-ppc64le-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java:
static final int O_APPEND =
./linux-ppc64le-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
./linux-ppc64le-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
02000
--
./linux-x86_64-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java:
static final int O_APPEND =
./linux-x86_64-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
./linux-x86_64-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
02000
--
./linux-s390x-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java:
static final int O_APPEND =
./linux-s390x-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
./linux-s390x-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
02000
--
./linux-aarch64-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java:
static final int O_APPEND =
./linux-aarch64-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
./linux-aarch64-server-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
02000
--
./linux-x86_64-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java:
static final int O_APPEND =
./linux-x86_64-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
./linux-x86_64-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
02000
--
./linux-mips64el-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java:
static final int O_APPEND =
./linux-mips64el-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
./linux-mips64el-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
0x0008
--
./linux-ppc64le-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java:
static final int O_APPEND =
./linux-ppc64le-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
./linux-ppc64le-zero-release/support/gensrc/java.base/sun/nio/fs/UnixConstants.java-
02000
log.mips:2of path:
/home/loongson/aoqi/jdk-mips/build/linux-mips64el-normal-server-release/support/interim-jmods/temp/.java.base.jmod.tmp
oflags: 769 O_TRUNC:512 O_APPEND:8 O_CREAT:256 O_EXCL:1024
log.ppc:2of path:
/home/loongson/aoqi/jdk-mips/build/linux-ppc64le-normal-server-release/support/interim-jmods/temp/.java.base.jmod.tmp
oflags: 577 O_TRUNC:512 O_APPEND:1024 O_CREAT:64 O_EXCL:128
Cheers,
Ao Qi