Skip to content

Commit

Permalink
Merge remote-tracking branch 'dragonwell_official_upstream/master' in…
Browse files Browse the repository at this point in the history
…to dragonwell11

Summary: merge upstream code

Test Plan: CI pipeline

Reviewed-by: D-D-H,yuleil

Issue: #225
  • Loading branch information
Accelerator1996 committed Aug 3, 2022
2 parents 6d256aa + edd32ef commit a7d813d
Show file tree
Hide file tree
Showing 1,893 changed files with 75,045 additions and 41,279 deletions.
272 changes: 202 additions & 70 deletions .github/workflows/submit.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .jcheck/conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[general]
project=jdk-updates
jbs=JDK
version=11.0.15
version=11.0.16

[checks]
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace
Expand Down
129 changes: 93 additions & 36 deletions doc/building.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h1 class="title">Building the JDK</h1>
<li><a href="#specifying-the-target-platform">Specifying the Target Platform</a></li>
<li><a href="#toolchain-considerations">Toolchain Considerations</a></li>
<li><a href="#native-libraries">Native Libraries</a></li>
<li><a href="#creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sysroots With qemu-deboostrap</a></li>
<li><a href="#cross-compiling-with-debian-sysroots">Cross compiling with Debian sysroots</a></li>
<li><a href="#building-for-armaarch64">Building for ARM/aarch64</a></li>
<li><a href="#building-for-musl">Building for musl</a></li>
<li><a href="#verifying-the-build">Verifying the Build</a></li>
Expand Down Expand Up @@ -411,7 +411,6 @@ <h3 id="alsa">ALSA</h3>
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libasound2-dev</code>.</li>
<li>To install on an rpm-based Linux, try running <code>sudo yum install alsa-lib-devel</code>.</li>
<li>To install on Alpine Linux, try running <code>sudo apk add alsa-lib-dev</code>.</li>

</ul>
<p>Use <code>--with-alsa=&lt;path&gt;</code> if <code>configure</code> does not properly locate your ALSA files.</p>
<h3 id="libffi">libffi</h3>
Expand Down Expand Up @@ -689,7 +688,7 @@ <h4 id="x11-1">X11</h4>
cp: cannot stat `arm-linux-gnueabihf/libXt.so&#39;: No such file or directory</code></pre></li>
<li><p>If the X11 libraries are not properly detected by <code>configure</code>, you can point them out by <code>--with-x</code>.</p></li>
</ul>
<h3 id="creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sysroots With qemu-deboostrap</h3>
<h3 id="cross-compiling-with-debian-sysroots">Cross compiling with Debian sysroots</h3>
<p>Fortunately, you can create sysroots for foreign architectures with tools provided by your OS. On Debian/Ubuntu systems, one could use <code>qemu-deboostrap</code> to create the <em>target</em> system chroot, which would have the native libraries and headers specific to that <em>target</em> system. After that, we can use the cross-compiler on the <em>build</em> system, pointing into chroot to get the build dependencies right. This allows building for foreign architectures with native compilation speed.</p>
<p>For example, cross-compiling to AArch64 from x86_64 could be done like this:</p>
<ul>
Expand All @@ -699,75 +698,133 @@ <h3 id="creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sys
<pre><code>sudo qemu-debootstrap \
--arch=arm64 \
--verbose \
--include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev \
--include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev,libffi-dev \
--resolve-deps \
buster \
~/sysroot-arm64 \
http://httpredir.debian.org/debian/</code></pre></li>
<li><p>Make sure the symlinks inside the newly created chroot point to proper locations:</p>
<pre><code>sudo chroot ~/sysroot-arm64 symlinks -cr .</code></pre></li>
<li><p>Configure and build with newly created chroot as sysroot/toolchain-path:</p>
<pre><code>CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ sh ./configure \
--openjdk-target=aarch64-linux-gnu \
--with-sysroot=~/sysroot-arm64 \
--with-toolchain-path=~/sysroot-arm64 \
--with-freetype-lib=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/ \
--with-freetype-include=~/sysroot-arm64/usr/include/freetype2/ \
--x-libraries=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/
<pre><code>sh ./configure \
--openjdk-target=aarch64-linux-gnu \
--with-sysroot=~/sysroot-arm64
make images
ls build/linux-aarch64-normal-server-release/</code></pre></li>
</ul>
<p>The build does not create new files in that chroot, so it can be reused for multiple builds without additional cleanup.</p>
<p>The build system should automatically detect the toolchain paths and dependencies, but sometimes it might require a little nudge with:</p>
<ul>
<li><p>Native compilers: override <code>CC</code> or <code>CXX</code> for <code>./configure</code></p></li>
<li><p>Freetype lib location: override <code>--with-freetype-lib</code>, for example <code>${sysroot}/usr/lib/${target}/</code></p></li>
<li><p>Freetype includes location: override <code>--with-freetype-include</code> for example <code>${sysroot}/usr/include/freetype2/</code></p></li>
<li><p>X11 libraries location: override <code>--x-libraries</code>, for example <code>${sysroot}/usr/lib/${target}/</code></p></li>
</ul>
<p>Architectures that are known to successfully cross-compile like this are:</p>
<table>
<thead>
<tr class="header">
<th style="text-align: left;">Target</th>
<th style="text-align: left;"><code>CC</code></th>
<th style="text-align: left;"><code>CXX</code></th>
<th><code>--arch=...</code></th>
<th><code>--openjdk-target=...</code></th>
<th style="text-align: left;">Debian tree</th>
<th style="text-align: left;">Debian arch</th>
<th style="text-align: left;"><code>--openjdk-target=...</code></th>
<th><code>--with-jvm-variants=...</code></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: left;">x86</td>
<td style="text-align: left;">default</td>
<td style="text-align: left;">default</td>
<td>i386</td>
<td>i386-linux-gnu</td>
<td style="text-align: left;">buster</td>
<td style="text-align: left;">i386</td>
<td style="text-align: left;">i386-linux-gnu</td>
<td>(all)</td>
</tr>
<tr class="even">
<td style="text-align: left;">arm</td>
<td style="text-align: left;">buster</td>
<td style="text-align: left;">armhf</td>
<td style="text-align: left;">gcc-arm-linux-gnueabihf</td>
<td style="text-align: left;">g++-arm-linux-gnueabihf</td>
<td>armhf</td>
<td>arm-linux-gnueabihf</td>
<td style="text-align: left;">arm-linux-gnueabihf</td>
<td>(all)</td>
</tr>
<tr class="odd">
<td style="text-align: left;">aarch64</td>
<td style="text-align: left;">gcc-aarch64-linux-gnu</td>
<td style="text-align: left;">g++-aarch64-linux-gnu</td>
<td>arm64</td>
<td>aarch64-linux-gnu</td>
<td style="text-align: left;">buster</td>
<td style="text-align: left;">arm64</td>
<td style="text-align: left;">aarch64-linux-gnu</td>
<td>(all)</td>
</tr>
<tr class="even">
<td style="text-align: left;">ppc64le</td>
<td style="text-align: left;">buster</td>
<td style="text-align: left;">ppc64el</td>
<td style="text-align: left;">gcc-powerpc64le-linux-gnu</td>
<td style="text-align: left;">g++-powerpc64le-linux-gnu</td>
<td>ppc64el</td>
<td>powerpc64le-linux-gnu</td>
<td style="text-align: left;">powerpc64le-linux-gnu</td>
<td>(all)</td>
</tr>
<tr class="odd">
<td style="text-align: left;">s390x</td>
<td style="text-align: left;">gcc-s390x-linux-gnu</td>
<td style="text-align: left;">g++-s390x-linux-gnu</td>
<td>s390x</td>
<td>s390x-linux-gnu</td>
<td style="text-align: left;">buster</td>
<td style="text-align: left;">s390x</td>
<td style="text-align: left;">s390x-linux-gnu</td>
<td>(all)</td>
</tr>
<tr class="even">
<td style="text-align: left;">mipsle</td>
<td style="text-align: left;">buster</td>
<td style="text-align: left;">mipsel</td>
<td style="text-align: left;">mipsel-linux-gnu</td>
<td>zero</td>
</tr>
<tr class="odd">
<td style="text-align: left;">mips64le</td>
<td style="text-align: left;">buster</td>
<td style="text-align: left;">mips64el</td>
<td style="text-align: left;">mips64el-linux-gnueabi64</td>
<td>zero</td>
</tr>
<tr class="even">
<td style="text-align: left;">armel</td>
<td style="text-align: left;">buster</td>
<td style="text-align: left;">arm</td>
<td style="text-align: left;">arm-linux-gnueabi</td>
<td>zero</td>
</tr>
<tr class="odd">
<td style="text-align: left;">ppc</td>
<td style="text-align: left;">sid</td>
<td style="text-align: left;">powerpc</td>
<td style="text-align: left;">powerpc-linux-gnu</td>
<td>zero</td>
</tr>
<tr class="even">
<td style="text-align: left;">ppc64be</td>
<td style="text-align: left;">sid</td>
<td style="text-align: left;">ppc64</td>
<td style="text-align: left;">powerpc64-linux-gnu</td>
<td>(all)</td>
</tr>
<tr class="odd">
<td style="text-align: left;">m68k</td>
<td style="text-align: left;">sid</td>
<td style="text-align: left;">m68k</td>
<td style="text-align: left;">m68k-linux-gnu</td>
<td>zero</td>
</tr>
<tr class="even">
<td style="text-align: left;">alpha</td>
<td style="text-align: left;">sid</td>
<td style="text-align: left;">alpha</td>
<td style="text-align: left;">alpha-linux-gnu</td>
<td>zero</td>
</tr>
<tr class="odd">
<td style="text-align: left;">sh4</td>
<td style="text-align: left;">sid</td>
<td style="text-align: left;">sh4</td>
<td style="text-align: left;">sh4-linux-gnu</td>
<td>zero</td>
</tr>
</tbody>
</table>
<p>Additional architectures might be supported by Debian/Ubuntu Ports.</p>
<h3 id="building-for-armaarch64">Building for ARM/aarch64</h3>
<p>A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using <code>--with-abi-profile</code>: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported by the JDK.</p>
<p>The JDK contains two different ports for the aarch64 platform, one is the original aarch64 port from the <a href="http://openjdk.java.net/projects/aarch64-port">AArch64 Port Project</a> and one is a 64-bit version of the Oracle contributed ARM port. When targeting aarch64, by the default the original aarch64 port is used. To select the Oracle ARM 64 port, use <code>--with-cpu-port=arm64</code>. Also set the corresponding value (<code>aarch64</code> or <code>arm64</code>) to --with-abi-profile, to ensure a consistent build.</p>
Expand Down
68 changes: 50 additions & 18 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ Note that X11 is needed even if you only want to build a headless JDK.
* If the X11 libraries are not properly detected by `configure`, you can
point them out by `--with-x`.
### Creating And Using Sysroots With qemu-deboostrap
### Cross compiling with Debian sysroots
Fortunately, you can create sysroots for foreign architectures with tools
provided by your OS. On Debian/Ubuntu systems, one could use `qemu-deboostrap` to
Expand All @@ -1123,7 +1123,7 @@ For example, cross-compiling to AArch64 from x86_64 could be done like this:
sudo qemu-debootstrap \
--arch=arm64 \
--verbose \
--include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev \
--include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev,libffi-dev \
--resolve-deps \
buster \
~/sysroot-arm64 \
Expand All @@ -1137,31 +1137,44 @@ For example, cross-compiling to AArch64 from x86_64 could be done like this:
* Configure and build with newly created chroot as sysroot/toolchain-path:
```
CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ sh ./configure \
--openjdk-target=aarch64-linux-gnu \
--with-sysroot=~/sysroot-arm64 \
--with-toolchain-path=~/sysroot-arm64 \
--with-freetype-lib=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/ \
--with-freetype-include=~/sysroot-arm64/usr/include/freetype2/ \
--x-libraries=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/
sh ./configure \
--openjdk-target=aarch64-linux-gnu \
--with-sysroot=~/sysroot-arm64
make images
ls build/linux-aarch64-normal-server-release/
```
The build does not create new files in that chroot, so it can be reused for multiple builds
without additional cleanup.
Architectures that are known to successfully cross-compile like this are:
The build system should automatically detect the toolchain paths and dependencies, but sometimes
it might require a little nudge with:
* Native compilers: override `CC` or `CXX` for `./configure`
Target `CC` `CXX` `--arch=...` `--openjdk-target=...`
------------ ------------------------- --------------------------- ------------ ----------------------
x86 default default i386 i386-linux-gnu
armhf gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf armhf arm-linux-gnueabihf
aarch64 gcc-aarch64-linux-gnu g++-aarch64-linux-gnu arm64 aarch64-linux-gnu
ppc64el gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu ppc64el powerpc64le-linux-gnu
s390x gcc-s390x-linux-gnu g++-s390x-linux-gnu s390x s390x-linux-gnu
* Freetype lib location: override `--with-freetype-lib`, for example `${sysroot}/usr/lib/${target}/`
Additional architectures might be supported by Debian/Ubuntu Ports.
* Freetype includes location: override `--with-freetype-include` for example `${sysroot}/usr/include/freetype2/`
* X11 libraries location: override `--x-libraries`, for example `${sysroot}/usr/lib/${target}/`
Architectures that are known to successfully cross-compile like this are:
Target Debian tree Debian arch `--openjdk-target=...` `--with-jvm-variants=...`
------------ ------------ ------------- ------------------------ --------------
x86 buster i386 i386-linux-gnu (all)
arm buster armhf arm-linux-gnueabihf (all)
aarch64 buster arm64 aarch64-linux-gnu (all)
ppc64le buster ppc64el powerpc64le-linux-gnu (all)
s390x buster s390x s390x-linux-gnu (all)
mipsle buster mipsel mipsel-linux-gnu zero
mips64le buster mips64el mips64el-linux-gnueabi64 zero
armel buster arm arm-linux-gnueabi zero
ppc sid powerpc powerpc-linux-gnu zero
ppc64be sid ppc64 powerpc64-linux-gnu (all)
m68k sid m68k m68k-linux-gnu zero
alpha sid alpha alpha-linux-gnu zero
sh4 sid sh4 sh4-linux-gnu zero
### Building for ARM/aarch64
Expand Down Expand Up @@ -1198,6 +1211,25 @@ original aarch64 port is used. To select the Oracle ARM 64 port, use
`--with-cpu-port=arm64`. Also set the corresponding value (`aarch64` or
`arm64`) to --with-abi-profile, to ensure a consistent build.
### Building for musl
Just like it's possible to cross-compile for a different CPU, it's possible to
cross-compile for musl libc on a glibc-based *build* system.
A devkit suitable for most target CPU architectures can be obtained from
[musl.cc](https://musl.cc). After installing the required packages in the
sysroot, configure the build with `--openjdk-target`:
```
sh ./configure --with-jvm-variants=server \
--with-boot-jdk=$BOOT_JDK \
--with-build-jdk=$BUILD_JDK \
--openjdk-target=x86_64-unknown-linux-musl \
--with-devkit=$DEVKIT \
--with-sysroot=$SYSROOT
```
and run `make` normally.
### Verifying the Build
The build will end up in a directory named like
Expand Down
4 changes: 3 additions & 1 deletion doc/testing.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ <h4 id="vm_options-1">VM_OPTIONS</h4>
<h4 id="aot_modules-1">AOT_MODULES</h4>
<p>Generate AOT modules before testing for the specified module, or set of modules. If multiple modules are specified, they should be separated by space (or, to help avoid quoting issues, the special value <code>%20</code>).</p>
<h4 id="retry_count">RETRY_COUNT</h4>
<p>Retry failed tests up to a set number of times. Defaults to 0.</p>
<p>Retry failed tests up to a set number of times, until they pass. This allows to pass the tests with intermittent failures. Defaults to 0.</p>
<h4 id="repeat_count">REPEAT_COUNT</h4>
<p>Repeat the tests up to a set number of times, stopping at first failure. This helps to reproduce intermittent test failures. Defaults to 0.</p>
<h3 id="gtest-keywords">Gtest keywords</h3>
<h4 id="repeat">REPEAT</h4>
<p>The number of times to repeat the tests (<code>--gtest_repeat</code>).</p>
Expand Down
10 changes: 9 additions & 1 deletion doc/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,15 @@ modules. If multiple modules are specified, they should be separated by space

#### RETRY_COUNT

Retry failed tests up to a set number of times. Defaults to 0.
Retry failed tests up to a set number of times, until they pass.
This allows to pass the tests with intermittent failures.
Defaults to 0.

#### REPEAT_COUNT

Repeat the tests up to a set number of times, stopping at first failure.
This helps to reproduce intermittent test failures.
Defaults to 0.

### Gtest keywords

Expand Down
23 changes: 22 additions & 1 deletion make/RunTests.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ $(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))

$(eval $(call ParseKeywordVariable, JTREG, \
SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR TEST_MODE ASSERT VERBOSE RETAIN \
MAX_MEM RETRY_COUNT, \
MAX_MEM RETRY_COUNT REPEAT_COUNT, \
STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS KEYWORDS \
EXTRA_PROBLEM_LISTS AOT_MODULES, \
))
Expand Down Expand Up @@ -652,6 +652,15 @@ define SetupRunJtregTestBody
JTREG_VERBOSE ?= fail,error,summary
JTREG_RETAIN ?= fail,error
JTREG_RETRY_COUNT ?= 0
JTREG_REPEAT_COUNT ?= 0

ifneq ($$(JTREG_RETRY_COUNT), 0)
ifneq ($$(JTREG_REPEAT_COUNT), 0)
$$(info Error: Cannot use both JTREG_RETRY_COUNT and JTREG_REPEAT_COUNT together.)
$$(info Please choose one or the other.)
$$(error Cannot continue)
endif
endif

ifneq ($$($1_JTREG_MAX_MEM), 0)
$1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM)
Expand Down Expand Up @@ -771,6 +780,18 @@ define SetupRunJtregTestBody
done
endif

ifneq ($$(JTREG_REPEAT_COUNT), 0)
$1_COMMAND_LINE := \
for i in {1..$$(JTREG_REPEAT_COUNT)}; do \
$$(PRINTF) "\nRepeating Jtreg run: $$$$i out of $$(JTREG_REPEAT_COUNT)\n"; \
$$($1_COMMAND_LINE); \
if [ "`$$(CAT) $$($1_EXITCODE)`" != "0" ]; then \
$$(PRINTF) "\nFailures detected, no more repeats.\n"; \
break; \
fi; \
done
endif

run-test-$1: clean-workdir-$1 $$($1_AOT_TARGETS)
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
Expand Down
11 changes: 11 additions & 0 deletions make/autoconf/build-aux/config.guess
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ if test $? = 0; then
OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
fi

# Detect C library.
# Use '-gnu' suffix on systems that use glibc.
# Use '-musl' suffix on systems that use the musl libc.
echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
if test $? = 0; then
libc_vendor=`ldd --version 2>&1 | sed -n '1s/.*\(musl\).*/\1/p'`
if [ x"${libc_vendor}" = x"musl" ]; then
OUT=`echo $OUT | sed 's/-gnu/-musl/'`
fi
fi

# Test and fix cygwin on x86_64
echo $OUT | grep 86-pc-cygwin > /dev/null 2> /dev/null
if test $? != 0; then
Expand Down
Loading

0 comments on commit a7d813d

Please sign in to comment.