logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git
commit: 0f24252e98130918b28718121960408ecf9d315a
parent bc65a715798f7a57d72983ef1c171678b827356f
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 17 Jan 2023 10:31:20 +0100

dev-java/icedtea: new package, add 7.2.6.28

This is based on dev-java/icedtea-7.2.6.9::gentoo-bootstrap

Diffstat:

Adev-java/icedtea/Manifest10++++++++++
Adev-java/icedtea/files/generate-cacerts.pl358+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea-hotspot-musl.patch55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea-hotspot-stop-using-obsolete-isnanf.patch42++++++++++++++++++++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea-jdk-execinfo.patch40++++++++++++++++++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea-jdk-fix-build.patch56++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea-jdk-musl.patch116+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea-jdk-no-soname.patch12++++++++++++
Adev-java/icedtea/files/icedtea-os_linux-remove-glibc-dependencies.patch75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea.env.sh18++++++++++++++++++
Adev-java/icedtea/files/icedtea7-disable-systemtap.patch20++++++++++++++++++++
Adev-java/icedtea/files/icedtea7-hotspot-miscompile.patch25+++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea7-hotspot-pointer-comparison.patch31+++++++++++++++++++++++++++++++
Adev-java/icedtea/files/icedtea7-jdk-fcommon.patch11+++++++++++
Adev-java/icedtea/files/icedtea7-jdk-freetype.patch11+++++++++++
Adev-java/icedtea/files/jamvm-1.6.0-aarch64-support.patch632+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adev-java/icedtea/files/jamvm-1.6.0-opcode-guard.patch35+++++++++++++++++++++++++++++++++++
Adev-java/icedtea/icedtea-7.2.6.28.ebuild402+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18 files changed, 1949 insertions(+), 0 deletions(-)

diff --git a/dev-java/icedtea/Manifest b/dev-java/icedtea/Manifest @@ -0,0 +1,10 @@ +DIST icedtea-2.6-corba-60fb55621427.tar.bz2 1077311 BLAKE2B c77bc0e56092f783e2cd3f918ce6fa551aecdca57cab3217aff178c931f691d1ba96b9731c54b4a1948c9aab2bf4cde8193efd4f631b65c534068a58259bc328 SHA512 9719f09aace720af6fb2cc3266b07058b982c57ae157fe9210e82028884a58519ba6a67e63fcf9031d943999b14c6066d2076944fc458cf66fd8ad5f14ab9876 +DIST icedtea-2.6-hotspot-d7f4f4901aa1.tar.bz2 8223348 BLAKE2B c8c2907ec760a934f7592a38d3dfc9041d27adbcd5f37e256900238060ec544d016fb5bf248625822b2063c1cd5ef6a20945e6be41f9b20a527a559e51db7039 SHA512 da0fd6a9055ed82adffc89f955b242ec2fb9927d59f02934fbcc885ea787f81661dc235e52e859fb872639def099a06ff7c7b1a1a5fc16417fd5a654f3bfdc23 +DIST icedtea-2.6-jaxp-2eedd3512498.tar.bz2 2730742 BLAKE2B b3dd148a8f56900e4a934e817718d978e3d2b483e71f575ea9095210ff6a1d88f95fb4673366477a7ecedf76ba5c4f3189b42ef4a165b018870c24e0a9af97d7 SHA512 5392528f5ce2c8a48724b184cda9d50f6a9feecec83a4d3568e64a35c24396fe09ca5d3716cacd6bcb9e6ea00427f1ef392f7da16e9a18e098a8bb4fb484d914 +DIST icedtea-2.6-jaxws-dc69e332d99f.tar.bz2 2024826 BLAKE2B 18c6afbf75b1209af2054adf94c6a0ccb33a987b649a4979172afa40e26507fb4804c873dffaeb5f2f6251e877d8682c21bb87e05d6322924d97a4eebcaabd51 SHA512 56da89c34120295c39f6d8a672be6214059d7b741407ffa102a7b0519a19b04302d1b332d97c577e4664fcd6217f673a53008e6ada89336092d6afe6e983b3c0 +DIST icedtea-2.6-jdk-f42b7efa98fe.tar.bz2 33621741 BLAKE2B 5e45f905356d603a145a61ddc4bd260e818d55b06aa894fe9a80ee639d0cbb9fc73ff147f8708d7b00c26356711b33fa946aaea30902c3d501260b2a9dc70e23 SHA512 9bc079bf3e28ea211b4bf4f738507ecb5610e18e27ff4af7e8bdfea3c2d219daa4a001f1e2d9ca71a7e7386b9ce40d5f16ff985b70624761a375219b8d699f5b +DIST icedtea-2.6-langtools-9cf0f33fe118.tar.bz2 1713015 BLAKE2B 393a04f6c65ad8924ea8153198e97938c8fb9ac5a4a34605c0c01e35dcf3defb4fe570cd00d11033732aa68d03d7e4270a315b58b372956472b1034b31f30e7a SHA512 6aa22ee0950801e710e47ef00ae7fb086bbef406d1d95c31bd8b16ff9254641673636fdf2a4922afd5ea0b9d2f23d8ed1ec6c68b6eb4055e95a68802fe1c983c +DIST icedtea-2.6-openjdk-b7da16493c1b.tar.bz2 132793 BLAKE2B baf8a11f1a6e4f7e68e0f5f85f24c8b9869be4aacba8c6c5eb59ac4ad2517d19b2a6dbee1eb23d3c776959a410f4e0b8da25010e6e9adcc75c6010f818ffaee4 SHA512 9c57d67bd55f5baba97a4f000ec5e23d8511682efa08a5c4780bb09acf9363ca640bdb187e60bf5dbc564b04e4b9caa8a5e928559052601557ce390e7056fd0e +DIST icedtea-2.6.28.tar.xz 2567520 BLAKE2B 676404153c94f997f4c4a6f4e2ac488b6b4cce84c502095d15b3b41fac33b0b6f0719e7cc7e902cca7c374c77594fdd3d96535f4f777cdb97825b8bea8d90b0a SHA512 00a3c4e69d50c365653d1afb9f344809e74802fad91cf153471de409677396ea6d1f4e68eeec45bb0a9fc368b6a3108047dc57960e2a975158c66233575092a7 +DIST icedtea-cacao-c182f119eaad.tar.gz 4485353 BLAKE2B 5c1faa3cbbfea62f819562a01ec389f3682cf3164d06f5404d1d16359c87b37d6ae4101f7c33cde30bad4f3d52af18f0f410e36868b2c9d1280661d2340e683b SHA512 2ccb947d71b80d84b83295d473c19952e98698a1fd944fc7c12004ff1af29af2989d46fbd95b5daf95eae2fda9de7c7f88f964fa887a6345b4f57d0c490bee23 +DIST icedtea-jamvm-ec18fb9e49e62dce16c5094ef1527eed619463aa.tar.gz 317187 BLAKE2B 1ca581a02be4cf5c09162687bbc90ec01b58b4910d866d11512cf17a1caff181fdc69e42f7498b2df9deb875ddc6efc6bc2888428f411da94bbc2313ddf5a2c9 SHA512 a31348481e1c02747f5bb9db333f855c45a1555aa187ee35de5ef553a10a8a47dfcc1beb1e69502046c1758438b91958a328e0a0015812c153221f67734a70a6 diff --git a/dev-java/icedtea/files/generate-cacerts.pl b/dev-java/icedtea/files/generate-cacerts.pl @@ -0,0 +1,358 @@ +#!/usr/bin/perl + +# Copyright (C) 2007, 2008 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# generate-cacerts.pl generates a JKS keystore named 'cacerts' from +# OpenSSL's certificate bundle using OpenJDK's keytool. + +# First extract each of OpenSSL's bundled certificates into its own +# aliased filename. + +# Downloaded from http://cvs.fedoraproject.org/viewvc/rpms/ca-certificates/F-12/generate-cacerts.pl?revision=1.2 +# Check and prevention of duplicate aliases added by Vlastimil Babka <caster@gentoo.org> + +$file = $ARGV[1]; +open(CERTS, $file); +@certs = <CERTS>; +close(CERTS); + +$pem_file_count = 0; +$in_cert_block = 0; +$write_current_cert = 1; +foreach $cert (@certs) +{ + if ($cert =~ /Issuer: /) + { + $_ = $cert; + if ($cert =~ /personal-freemail/) + { + $cert_alias = "thawtepersonalfreemailca"; + } + elsif ($cert =~ /personal-basic/) + { + $cert_alias = "thawtepersonalbasicca"; + } + elsif ($cert =~ /personal-premium/) + { + $cert_alias = "thawtepersonalpremiumca"; + } + elsif ($cert =~ /server-certs/) + { + $cert_alias = "thawteserverca"; + } + elsif ($cert =~ /premium-server/) + { + $cert_alias = "thawtepremiumserverca"; + } + elsif ($cert =~ /Class 1 Public Primary Certification Authority$/) + { + $cert_alias = "verisignclass1ca"; + } + elsif ($cert =~ /Class 1 Public Primary Certification Authority - G2/) + { + $cert_alias = "verisignclass1g2ca"; + } + elsif ($cert =~ + /VeriSign Class 1 Public Primary Certification Authority - G3/) + { + $cert_alias = "verisignclass1g3ca"; + } + elsif ($cert =~ /Class 2 Public Primary Certification Authority$/) + { + $cert_alias = "verisignclass2ca"; + } + elsif ($cert =~ /Class 2 Public Primary Certification Authority - G2/) + { + $cert_alias = "verisignclass2g2ca"; + } + elsif ($cert =~ + /VeriSign Class 2 Public Primary Certification Authority - G3/) + { + $cert_alias = "verisignclass2g3ca"; + } + elsif ($cert =~ /Class 3 Public Primary Certification Authority$/) + { + $cert_alias = "verisignclass3ca"; + } + # Version 1 of Class 3 Public Primary Certification Authority + # - G2 is added. Version 3 is excluded. See below. + elsif ($cert =~ + /VeriSign Class 3 Public Primary Certification Authority - G3/) + { + $cert_alias = "verisignclass3g3ca"; + } + elsif ($cert =~ + /RSA Data Security.*Secure Server Certification Authority/) + { + $cert_alias = "verisignserverca"; + } + elsif ($cert =~ /GTE CyberTrust Global Root/) + { + $cert_alias = "gtecybertrustglobalca"; + } + elsif ($cert =~ /Baltimore CyberTrust Root/) + { + $cert_alias = "baltimorecybertrustca"; + } + elsif ($cert =~ /www.entrust.net\/Client_CA_Info\/CPS/) + { + $cert_alias = "entrustclientca"; + } + elsif ($cert =~ /www.entrust.net\/GCCA_CPS/) + { + $cert_alias = "entrustglobalclientca"; + } + elsif ($cert =~ /www.entrust.net\/CPS_2048/) + { + $cert_alias = "entrust2048ca"; + } + elsif ($cert =~ /www.entrust.net\/CPS /) + { + $cert_alias = "entrustsslca"; + } + elsif ($cert =~ /www.entrust.net\/SSL_CPS/) + { + $cert_alias = "entrustgsslca"; + } + elsif ($cert =~ /The Go Daddy Group/) + { + $cert_alias = "godaddyclass2ca"; + } + elsif ($cert =~ /Starfield Class 2 Certification Authority/) + { + $cert_alias = "starfieldclass2ca"; + } + elsif ($cert =~ /ValiCert Class 2 Policy Validation Authority/) + { + $cert_alias = "valicertclass2ca"; + } + elsif ($cert =~ /GeoTrust Global CA$/) + { + $cert_alias = "geotrustglobalca"; + } + elsif ($cert =~ /Equifax Secure Certificate Authority/) + { + $cert_alias = "equifaxsecureca"; + } + elsif ($cert =~ /Equifax Secure eBusiness CA-1/) + { + $cert_alias = "equifaxsecureebusinessca1"; + } + elsif ($cert =~ /Equifax Secure eBusiness CA-2/) + { + $cert_alias = "equifaxsecureebusinessca2"; + } + elsif ($cert =~ /Equifax Secure Global eBusiness CA-1/) + { + $cert_alias = "equifaxsecureglobalebusinessca1"; + } + elsif ($cert =~ /Sonera Class1 CA/) + { + $cert_alias = "soneraclass1ca"; + } + elsif ($cert =~ /Sonera Class2 CA/) + { + $cert_alias = "soneraclass2ca"; + } + elsif ($cert =~ /AAA Certificate Services/) + { + $cert_alias = "comodoaaaca"; + } + elsif ($cert =~ /AddTrust Class 1 CA Root/) + { + $cert_alias = "addtrustclass1ca"; + } + elsif ($cert =~ /AddTrust External CA Root/) + { + $cert_alias = "addtrustexternalca"; + } + elsif ($cert =~ /AddTrust Qualified CA Root/) + { + $cert_alias = "addtrustqualifiedca"; + } + elsif ($cert =~ /UTN-USERFirst-Hardware/) + { + $cert_alias = "utnuserfirsthardwareca"; + } + elsif ($cert =~ /UTN-USERFirst-Client Authentication and Email/) + { + $cert_alias = "utnuserfirstclientauthemailca"; + } + elsif ($cert =~ /UTN - DATACorp SGC/) + { + $cert_alias = "utndatacorpsgcca"; + } + elsif ($cert =~ /UTN-USERFirst-Object/) + { + $cert_alias = "utnuserfirstobjectca"; + } + elsif ($cert =~ /America Online Root Certification Authority 1/) + { + $cert_alias = "aolrootca1"; + } + elsif ($cert =~ /DigiCert Assured ID Root CA/) + { + $cert_alias = "digicertassuredidrootca"; + } + elsif ($cert =~ /DigiCert Global Root CA/) + { + $cert_alias = "digicertglobalrootca"; + } + elsif ($cert =~ /DigiCert High Assurance EV Root CA/) + { + $cert_alias = "digicerthighassuranceevrootca"; + } + elsif ($cert =~ /GlobalSign Root CA$/) + { + $cert_alias = "globalsignca"; + } + elsif ($cert =~ /GlobalSign Root CA - R2/) + { + $cert_alias = "globalsignr2ca"; + } + elsif ($cert =~ /Elektronik.*Kas.*2005/) + { + $cert_alias = "extra-elektronikkas2005"; + } + elsif ($cert =~ /Elektronik/) + { + $cert_alias = "extra-elektronik2005"; + } + # Mozilla does not provide these certificates: + # baltimorecodesigningca + # gtecybertrust5ca + # trustcenterclass2caii + # trustcenterclass4caii + # trustcenteruniversalcai + else + { + # Generate an alias using the OU and CN attributes of the + # Issuer field if both are present, otherwise use only the + # CN attribute. The Issuer field must have either the OU + # or the CN attribute. + $_ = $cert; + if ($cert =~ /OU=/) + { + s/Issuer:.*?OU=//; + # Remove other occurrences of OU=. + s/OU=.*CN=//; + # Remove CN= if there were not other occurrences of OU=. + s/CN=//; + s/\/emailAddress.*//; + s/Certificate Authority/ca/g; + s/Certification Authority/ca/g; + } + elsif ($cert =~ /CN=/) + { + s/Issuer:.*CN=//; + s/\/emailAddress.*//; + s/Certificate Authority/ca/g; + s/Certification Authority/ca/g; + } + s/\W//g; + tr/A-Z/a-z/; + $cert_alias = "extra-$_"; + + } + while (-e "$cert_alias.pem") + { + $cert_alias = "$cert_alias" . "_"; + } + } + # When it attempts to parse: + # + # Class 3 Public Primary Certification Authority - G2, Version 3 + # + # keytool says: + # + # #2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false + # Unparseable AuthorityInfoAccess extension due to + # java.io.IOException: Invalid encoding of URI + # + # If we do not exclude this file + # openjdk/jdk/test/lib/security/cacerts/VerifyCACerts.java fails + # on this cert, printing: + # + # Couldn't verify: java.security.SignatureException: Signature + # does not match. + # + elsif ($cert =~ + /A6:0F:34:C8:62:6C:81:F6:8B:F7:7D:A9:F6:67:58:8A:90:3F:7D:36/) + { + $write_current_cert = 0; + $pem_file_count--; + } + elsif ($cert eq "-----BEGIN CERTIFICATE-----\n") + { + if ($in_cert_block != 0) + { + die "$file is malformed."; + } + $in_cert_block = 1; + if ($write_current_cert == 1) + { + $pem_file_count++; + if (-e "$cert_alias.pem") + { + print "$cert_alias"; + die "already exists" + } + open(PEM, ">$cert_alias.pem"); + print PEM $cert; + } + } + elsif ($cert eq "-----END CERTIFICATE-----\n") + { + $in_cert_block = 0; + if ($write_current_cert == 1) + { + print PEM $cert; + close(PEM); + } + $write_current_cert = 1 + } + else + { + if ($in_cert_block == 1 && $write_current_cert == 1) + { + print PEM $cert; + } + } +} + +# Check that the correct number of .pem files were produced. +@pem_files = <*.pem>; +if (@pem_files != $pem_file_count) +{ + print "$pem_file_count"; + die "Number of .pem files produced does not match". + " number of certs read from $file."; +} + +# Now store each cert in the 'cacerts' file using keytool. +$certs_written_count = 0; +foreach $pem_file (@pem_files) +{ + system "$ARGV[0] -noprompt -import". + " -alias `basename $pem_file .pem`". + " -keystore cacerts -storepass 'changeit' -file $pem_file"; + unlink($pem_file); + $certs_written_count++; +} + +# Check that the correct number of certs were added to the keystore. +if ($certs_written_count != $pem_file_count) +{ + die "Number of certs added to keystore does not match". + " number of certs read from $file."; +} diff --git a/dev-java/icedtea/files/icedtea-hotspot-musl.patch b/dev-java/icedtea/files/icedtea-hotspot-musl.patch @@ -0,0 +1,55 @@ +--- openjdk.orig/hotspot/src/os/linux/vm/jvm_linux.cpp ++++ openjdk/hotspot/src/os/linux/vm/jvm_linux.cpp +@@ -154,7 +154,9 @@ + #ifdef SIGSTKFLT + "STKFLT", SIGSTKFLT, /* Stack fault. */ + #endif ++#ifdef SIGCLD + "CLD", SIGCLD, /* Same as SIGCHLD (System V). */ ++#endif + "CHLD", SIGCHLD, /* Child status has changed (POSIX). */ + "CONT", SIGCONT, /* Continue (POSIX). */ + "STOP", SIGSTOP, /* Stop, unblockable (POSIX). */ +--- openjdk.orig/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp ++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +@@ -73,7 +73,6 @@ + # include <pwd.h> + # include <poll.h> + # include <ucontext.h> +-# include <fpu_control.h> + + #ifdef AMD64 + #define REG_SP REG_RSP +@@ -532,6 +531,9 @@ + + ShouldNotReachHere(); + } ++ ++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw)) ++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)) + + void os::Linux::init_thread_fpu_state(void) { + #ifndef AMD64 +--- openjdk.orig/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp ++++ openjdk/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp +@@ -32,7 +32,9 @@ + // map stack pointer to thread pointer - see notes in threadLS_linux_x86.cpp + #define SP_BITLENGTH 32 + #define PAGE_SHIFT 12 ++ #ifndef PAGE_SIZE + #define PAGE_SIZE (1UL << PAGE_SHIFT) ++ #endif + static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)]; + + public: +--- openjdk.orig/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp ++++ openjdk/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +@@ -75,7 +75,7 @@ + # include <pwd.h> + # include <poll.h> + # include <ucontext.h> +-# include <fpu_control.h> ++# include <linux/types.h> /* provides __u64 */ + + #ifdef BUILTIN_SIM + #define REG_SP REG_RSP diff --git a/dev-java/icedtea/files/icedtea-hotspot-stop-using-obsolete-isnanf.patch b/dev-java/icedtea/files/icedtea-hotspot-stop-using-obsolete-isnanf.patch @@ -0,0 +1,42 @@ +From 1624e2dd3739fe208efa13b31abf4bc53ae2e5c1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>> +Date: Tue, 27 Feb 2018 11:24:44 +0000 +Subject: [PATCH 1/9] hotspot: stop using obsolete isnanf() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Compiling against musl-libc gives the following error: +| hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp: In function 'int g_isnan(float)': +| hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp:238:39: error: 'isnanf' was not declared in this scope +| inline int g_isnan(float f) { return isnanf(f); } +| ^~~~~~ + +isnanf() is obsolete, and musl doesn't implement it. isnan() +is the right thing to use for all types (float and double), +replacing isnanf(), even on glibc. + +Do so. + +Upstream-Status: Pending +Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>> +--- + hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp +index efa0b4e1..6df2302e 100644 +--- openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp ++++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp +@@ -235,7 +235,7 @@ inline int g_isnan(double f) { return isnand(f); } + #elif defined(__APPLE__) + inline int g_isnan(double f) { return isnan(f); } + #elif defined(LINUX) || defined(_ALLBSD_SOURCE) +-inline int g_isnan(float f) { return isnanf(f); } ++inline int g_isnan(float f) { return isnan(f); } + inline int g_isnan(double f) { return isnan(f); } + #else + #error "missing platform-specific definition here" +-- +2.16.2 + diff --git a/dev-java/icedtea/files/icedtea-jdk-execinfo.patch b/dev-java/icedtea/files/icedtea-jdk-execinfo.patch @@ -0,0 +1,40 @@ +--- openjdk.orig/jdk/src/solaris/native/sun/awt/awt_xembed_server.c ++++ openjdk/jdk/src/solaris/native/sun/awt/awt_xembed_server.c +@@ -35,7 +35,7 @@ + #include <X11/Xlib.h> + #include <X11/Xatom.h> + #include <Xm/MwmUtil.h> +-#ifdef __linux__ ++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__) + #include <execinfo.h> + #endif + #include <stdio.h> +@@ -835,7 +835,7 @@ + AWT_UNLOCK(); + } + +-#ifdef __linux__ ++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__) + void + print_stack (void) + { +--- openjdk.orig/jdk/src/solaris/native/sun/xawt/XToolkit.c ++++ openjdk/jdk/src/solaris/native/sun/xawt/XToolkit.c +@@ -27,7 +27,7 @@ + #include <X11/Xutil.h> + #include <X11/Xos.h> + #include <X11/Xatom.h> +-#ifdef __linux__ ++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__) + #include <execinfo.h> + #endif + +@@ -689,7 +689,7 @@ + return ret; + } + +-#ifdef __linux__ ++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__) + void print_stack(void) + { + void *array[10]; diff --git a/dev-java/icedtea/files/icedtea-jdk-fix-build.patch b/dev-java/icedtea/files/icedtea-jdk-fix-build.patch @@ -0,0 +1,56 @@ +Fixes three issues: + - so's should not be linked to -ljvm as dlopen(/abs/name) is + used by the launcher to load libjvm.so; it is thus not available + (musl/uclibc) ld.so to satisfy NEEDED dependency inserted by + -ljvm. Fix to not link against -ljvm, and disable -z defs so + undefined symbols are allowed in sos + - the previous makes ldd generate errors on unresolved symbols (musl) + remove it altogether as it's used for informative purposes only + (display things - not check anything useful) + - Don't delete the generated directory $(GENCSEXT), this can + confuse make in highly parallel builds with: + make[6]: *** INTERNAL: readdir: No such file or directory. Stop. + make[6]: Leaving directory '.../openjdk-boot/jdk/make/sun/nio/cs' + +--- openjdk.orig/jdk/make/common/Defs-linux.gmk ++++ openjdk/jdk/make/common/Defs-linux.gmk +@@ -350,7 +350,7 @@ + + EXTRA_LIBS += -lc + +-LDFLAGS_DEFS_OPTION = -Xlinker -z -Xlinker defs ++LDFLAGS_DEFS_OPTION = + LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) + + # +@@ -407,7 +407,7 @@ + # the library itself should not. + # + VM_NAME = server +-JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm ++JVMLIB = + JAVALIB = -ljava $(JVMLIB) + + # +--- openjdk.orig/jdk/make/sun/nio/cs/Makefile ++++ openjdk/jdk/make/sun/nio/cs/Makefile +@@ -107,7 +107,7 @@ + $(GENCSDATASRC)/DoubleByte-X.java.template \ + $(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs + @$(prep-target) +- $(RM) -r $(GENCSEXT) ++ $(RM) -f "$(GENCSEXT)"/* + $(MKDIR) -p $(GENCSEXT) + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) extsbcs + $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSDATASRC) $(GENCSEXT) euctw \ +--- openjdk.orig/jdk/make/common/shared/Defs-linux.gmk ++++ openjdk/jdk/make/common/shared/Defs-linux.gmk +@@ -207,8 +207,6 @@ + if [ "`$(NM) -D -g --defined-only $1 | $(EGREP) 'SUNWprivate'`" = "" ] ; then \ + $(ECHO) "$(MAPFILE_WARNING): File was not built with a mapfile: $1"; \ + fi && \ +- $(ECHO) "Library loads for: $1" && \ +- $(LDD) $1 && \ + $(ECHO) "RUNPATH for: $1" && \ + ( $(READELF) -d $1 | $(EGREP) 'NEEDED|RUNPATH|RPATH' ) \ + ) diff --git a/dev-java/icedtea/files/icedtea-jdk-musl.patch b/dev-java/icedtea/files/icedtea-jdk-musl.patch @@ -0,0 +1,116 @@ +diff -ru openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp +--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2014-07-15 07:19:52.186682096 +0000 +@@ -46,6 +46,8 @@ + + #include "zip.h" + ++#define uchar unsigned char ++ + #ifdef NO_ZLIB + + inline bool jar::deflate_bytes(bytes& head, bytes& tail) { +diff -ru openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h +--- openjdk.orig/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2014-07-15 07:19:52.186682096 +0000 +@@ -23,9 +23,7 @@ + * questions. + */ + +-#define ushort unsigned short +-#define uint unsigned int +-#define uchar unsigned char ++#include <sys/types.h> + + struct unpacker; + +diff -ru openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h +--- openjdk.orig/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2014-07-15 07:19:52.186682096 +0000 +@@ -27,6 +27,7 @@ + #ifndef MLIB_TYPES_H + #define MLIB_TYPES_H + ++#include <stddef.h> /* for NULL */ + #include <limits.h> + #if defined(_MSC_VER) + #include <float.h> /* for FLT_MAX and DBL_MAX */ +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c +--- openjdk.orig/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2014-07-15 07:19:52.186682096 +0000 +@@ -47,7 +47,7 @@ + + #include "java_net_Inet4AddressImpl.h" + +-#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104)) ++#if defined(__linux__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104)) + #define HAS_GLIBC_GETHOSTBY_R 1 + #endif + +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/NetworkInterface.c openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c +--- openjdk.orig/jdk/src/solaris/native/java/net/NetworkInterface.c 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/NetworkInterface.c 2014-07-15 07:19:52.186682096 +0000 +@@ -47,7 +47,6 @@ + + #ifdef __linux__ + #include <sys/ioctl.h> +-#include <bits/ioctls.h> + #include <sys/utsname.h> + #include <stdio.h> + #endif +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c +--- openjdk.orig/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c 2014-07-15 07:19:52.190015524 +0000 +@@ -35,7 +35,6 @@ + #endif + #ifdef __linux__ + #include <unistd.h> +-#include <sys/sysctl.h> + #include <sys/utsname.h> + #include <netinet/ip.h> + +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c +--- openjdk.orig/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2014-07-15 07:19:52.190015524 +0000 +@@ -43,7 +43,6 @@ + #endif + #ifdef __linux__ + #include <unistd.h> +-#include <sys/sysctl.h> + #endif + + #include "jvm.h" +diff -ru openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c openjdk/jdk/src/solaris/native/java/net/linux_close.c +--- openjdk.orig/jdk/src/solaris/native/java/net/linux_close.c 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/java/net/linux_close.c 2014-07-15 07:22:17.609355950 +0000 +@@ -75,7 +75,7 @@ + #ifdef _AIX + static int sigWakeup = (SIGRTMAX - 1); + #else +-static int sigWakeup = (__SIGRTMAX - 2); ++static int sigWakeup; + #endif + + /* +@@ -148,6 +148,9 @@ + /* + * Setup the signal handler + */ ++#ifndef __AIX ++ sigWakeup = SIGRTMAX - 2; ++#endif + sa.sa_handler = sig_wakeup; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); +diff -ru openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c +--- openjdk.orig/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2014-06-12 20:14:44.000000000 +0000 ++++ openjdk/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2014-07-15 07:19:52.190015524 +0000 +@@ -38,7 +38,7 @@ + #include <sys/signal.h> + + /* Also defined in src/solaris/native/java/net/linux_close.c */ +-#define INTERRUPT_SIGNAL (__SIGRTMAX - 2) ++#define INTERRUPT_SIGNAL (SIGRTMAX - 2) + + static void + nullHandler(int sig) diff --git a/dev-java/icedtea/files/icedtea-jdk-no-soname.patch b/dev-java/icedtea/files/icedtea-jdk-no-soname.patch @@ -0,0 +1,12 @@ +--- ./openjdk/jdk/make/common/Defs-linux.gmk.orig ++++ ./openjdk/jdk/make/common/Defs-linux.gmk +@@ -248,7 +248,9 @@ + # + LDFLAGS_OPT = -Xlinker -O1 + LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) ++ifdef LIBRARY + LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) ++endif + + # + # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always diff --git a/dev-java/icedtea/files/icedtea-os_linux-remove-glibc-dependencies.patch b/dev-java/icedtea/files/icedtea-os_linux-remove-glibc-dependencies.patch @@ -0,0 +1,75 @@ +From a02a9fbc3f1fed181504bdb5b0a16863247f92fc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>> +Date: Fri, 2 Mar 2018 10:11:51 +0000 +Subject: [PATCH 6/9] hotspot: os_linux: remove glibc dependencies +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* gnu/libc-version.h doesn't exist in musl + | hotspot/src/os/linux/vm/os_linux.cpp:97:11: fatal error: gnu/libc-version.h: No such file or directory + | # include <gnu/libc-version.h> + | ^~~~~~~~~~~~~~~~~~~~ + +* dlvsym() is a GNU extension and doesn't exist in musl + | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: error: 'dlvsym' was not declared in this scope + | void *f = dlvsym(handle, name, "libnuma_1.1"); + | ^~~~~~ + | hotspot/src/os/linux/vm/os_linux.cpp:2846:13: note: suggested alternative: 'dlsym' + | void *f = dlvsym(handle, name, "libnuma_1.1"); + | ^~~~~~ + | dlsym + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: André Draszik <andre.draszik at jci.com <https://lists.yoctoproject.org/listinfo/yocto>> +--- + hotspot/src/os/linux/vm/os_linux.cpp | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp +index 044a70a6..3137796a 100644 +--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp +@@ -94,7 +94,6 @@ + # include <string.h> + # include <syscall.h> + # include <sys/sysinfo.h> +-# include <gnu/libc-version.h> + # include <sys/ipc.h> + # include <sys/shm.h> + # include <link.h> +@@ -530,6 +529,13 @@ void os::Linux::hotspot_sigmask(Thread* thread) { + // detecting pthread library + + void os::Linux::libpthread_init() { ++#if 1 ++ // Hard code supported musl compatible settings (taken from alpine linux) ++ os::Linux::set_glibc_version("glibc 2.9"); ++ os::Linux::set_libpthread_version("NPTL"); ++ os::Linux::set_is_NPTL(); ++ os::Linux::set_is_floating_stack(); ++#else + // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION + // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a + // generic name for earlier versions. +@@ -588,6 +594,7 @@ void os::Linux::libpthread_init() { + if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) { + os::Linux::set_is_floating_stack(); + } ++#endif + } + + ///////////////////////////////////////////////////////////////////////////// +@@ -2814,6 +2821,9 @@ int os::Linux::sched_getcpu_syscall(void) { + return (retval == -1) ? retval : cpu; + } + ++// musl doesn't have dlvsym() ++#define dlvsym(h,s,v) dlsym(h,s) ++ + // Something to do with the numa-aware allocator needs these symbols + extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { } + extern "C" JNIEXPORT void numa_error(char *where) { } +-- +2.16.2 + diff --git a/dev-java/icedtea/files/icedtea.env.sh b/dev-java/icedtea/files/icedtea.env.sh @@ -0,0 +1,18 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +VERSION="IcedTea JDK ${PV}" +JAVA_HOME="${EPREFIX}/usr/$(get_libdir)/icedtea${SLOT}" +JDK_HOME="${EPREFIX}/usr/$(get_libdir)/icedtea${SLOT}" +JAVAC="\${JAVA_HOME}/bin/javac" +PATH="\${JAVA_HOME}/bin:\${JAVA_HOME}/jre/bin" +ROOTPATH="\${JAVA_HOME}/bin:\${JAVA_HOME}/jre/bin" +LDPATH="\${JAVA_HOME}/jre/lib/$(get_system_arch)/:\${JAVA_HOME}/jre/lib/$(get_system_arch)/server/$([[ ${SLOT} = [67] ]] && printf :\${JAVA_HOME}/jre/lib/$(get_system_arch)/xawt/)$([[ ${SLOT} = 6 ]] && printf :\${JAVA_HOME}/jre/lib/$(get_system_arch)/native_threads/)" +MANPATH="${EPREFIX}/usr/$(get_libdir)/icedtea${SLOT}/man" +PROVIDES_TYPE="JDK JRE" +PROVIDES_VERSION="1.${SLOT}" +# Taken from sun.boot.class.path property +BOOTCLASSPATH="\${JAVA_HOME}/jre/lib/resources.jar:\${JAVA_HOME}/jre/lib/rt.jar:\${JAVA_HOME}/jre/lib/sunrsasign.jar:\${JAVA_HOME}/jre/lib/jsse.jar:\${JAVA_HOME}/jre/lib/jce.jar:\${JAVA_HOME}/jre/lib/charsets.jar:\${JAVA_HOME}/jre/lib/jfr.jar" +GENERATION="2" +ENV_VARS="JAVA_HOME JDK_HOME JAVAC PATH ROOTPATH LDPATH MANPATH" diff --git a/dev-java/icedtea/files/icedtea7-disable-systemtap.patch b/dev-java/icedtea/files/icedtea7-disable-systemtap.patch @@ -0,0 +1,20 @@ +--- a/Makefile.am 2020-07-16 14:34:04.759855943 +0000 ++++ b/Makefile.am 2020-07-16 14:34:29.151797650 +0000 +@@ -3156,7 +3156,6 @@ + ${mkinstalldirs} $(DESTDIR)${prefix}/jre/bin $(DESTDIR)${prefix}/jre/lib + ${mkinstalldirs} $(DESTDIR)${prefix}/jre/lib/$(INSTALL_ARCH_DIR)/{.,headless,jli,xawt} + ${mkinstalldirs} $(DESTDIR)${prefix}/jre/lib/ext +- ${mkinstalldirs} $(DESTDIR)${prefix}/tapset + if SPLIT_DEBUGINFO + ${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/$(bindir) $(DESTDIR)$(DEBUG_PREFIX)/${exec_prefix}/lib + ${mkinstalldirs} $(DESTDIR)$(DEBUG_PREFIX)/${exec_prefix}/lib/$(INSTALL_ARCH_DIR) +@@ -3256,9 +3255,6 @@ + for files in $(BUILD_SDK_DIR)/jre/lib/ext/*.jar; do \ + $(call install_file,$${files},$(DESTDIR)${prefix}/jre/lib/ext,$(INSTALL_DATA));\ + done +- for files in $(BUILD_SDK_DIR)/tapset/*.stp; do \ +- $(call install_file,$${files},$(DESTDIR)${prefix}/tapset,$(INSTALL_DATA));\ +- done + $(abs_top_builddir)/pax-mark-vm $(DESTDIR)${prefix} false + + install-data-local: diff --git a/dev-java/icedtea/files/icedtea7-hotspot-miscompile.patch b/dev-java/icedtea/files/icedtea7-hotspot-miscompile.patch @@ -0,0 +1,25 @@ +--- openjdk.orig/hotspot/src/share/vm/memory/dump.cpp 2021-12-06 19:02:27.037014756 +0000 ++++ openjdk/hotspot/src/share/vm/memory/dump.cpp 2021-12-06 19:03:01.597850811 +0000 +@@ -1426,7 +1426,11 @@ + /* Skip spaces and control characters */ + continue; + } +- h = 31 * h + c; ++ jlong h0 = h; ++ for(int i = 0; i < 5; i++) { ++ h += h; ++ } ++ h += c - h0; + } + return h; + } +--- openjdk/hotspot/src/share/vm/memory/dump.cpp.orig 2021-12-07 00:12:44.969219667 +0000 ++++ openjdk/hotspot/src/share/vm/memory/dump.cpp 2021-12-07 00:12:54.219429310 +0000 +@@ -1554,7 +1554,6 @@ + if (computed_jsum != file_jsum) { + tty->cr(); + tty->print_cr("Preload failed: checksum of class list was incorrect."); +- exit(1); + } + + tty->print_cr("done. "); diff --git a/dev-java/icedtea/files/icedtea7-hotspot-pointer-comparison.patch b/dev-java/icedtea/files/icedtea7-hotspot-pointer-comparison.patch @@ -0,0 +1,31 @@ +--- openjdk.orig/hotspot/src/share/vm/opto/lcm.cpp 2021-12-06 12:25:52.743843656 +0000 ++++ openjdk/hotspot/src/share/vm/opto/lcm.cpp 2021-12-06 12:26:05.814241520 +0000 +@@ -60,7 +60,7 @@ + // Check whether val is not-null-decoded compressed oop, + // i.e. will grab into the base of the heap if it represents NULL. + static bool accesses_heap_base_zone(Node *val) { +- if (UseCompressedOops && Universe::narrow_oop_base() > 0) { ++ if (UseCompressedOops && (Universe::narrow_oop_base() != 0)) { + if (val && val->is_Mach()) { + if (val->as_Mach()->ideal_Opcode() == Op_DecodeN) { + // This assumes all Decodes with TypePtr::NotNull are matched to nodes that +--- openjdk.orig/hotspot/src/share/vm/runtime/virtualspace.cpp 2021-12-06 13:08:11.976366383 +0000 ++++ openjdk/hotspot/src/share/vm/runtime/virtualspace.cpp 2021-12-06 13:08:34.377048681 +0000 +@@ -527,7 +527,7 @@ + (UseCompressedOops && (Universe::narrow_oop_base() != NULL) && + Universe::narrow_oop_use_implicit_null_checks()) ? + lcm(os::vm_page_size(), alignment) : 0) { +- if (base() > 0) { ++ if (base() != 0) { + MemTracker::record_virtual_memory_type((address)base(), mtJavaHeap); + } + +@@ -546,7 +546,7 @@ + (UseCompressedOops && (Universe::narrow_oop_base() != NULL) && + Universe::narrow_oop_use_implicit_null_checks()) ? + lcm(os::vm_page_size(), prefix_align) : 0) { +- if (base() > 0) { ++ if (base() != 0) { + MemTracker::record_virtual_memory_type((address)base(), mtJavaHeap); + } + diff --git a/dev-java/icedtea/files/icedtea7-jdk-fcommon.patch b/dev-java/icedtea/files/icedtea7-jdk-fcommon.patch @@ -0,0 +1,11 @@ +--- openjdk.orig/jdk/make/common/Defs-linux.gmk 2021-12-06 17:35:01.291049716 +0000 ++++ openjdk/jdk/make/common/Defs-linux.gmk 2021-12-06 17:35:28.811707263 +0000 +@@ -271,7 +271,7 @@ + # + # Misc compiler options + # +-CFLAGS_COMMON = -fno-strict-aliasing ++CFLAGS_COMMON = -fno-strict-aliasing -fcommon + PIC_CODE_LARGE = -fPIC + PIC_CODE_SMALL = -fpic + GLOBAL_KPIC = $(PIC_CODE_LARGE) diff --git a/dev-java/icedtea/files/icedtea7-jdk-freetype.patch b/dev-java/icedtea/files/icedtea7-jdk-freetype.patch @@ -0,0 +1,11 @@ +--- openjdk.orig/jdk/make/common/shared/Defs-versions.gmk 2011-04-11 15:03:04.000000000 +0100 ++++ openjdk/jdk/make/common/shared/Defs-versions.gmk 2021-12-06 00:33:27.338540213 +0000 +@@ -213,7 +213,7 @@ + # Generic + REQUIRED_ANT_VER = 1.7.1 + REQUIRED_BOOT_VER = 1.6 +-REQUIRED_FREETYPE_VERSION = 2.2.1 ++REQUIRED_FREETYPE_VERSION = 2.10.1 + REQUIRED_MAKE_VER = 3.81 + REQUIRED_UNZIP_VER = 5.12 + REQUIRED_ZIP_VER = 2.2 diff --git a/dev-java/icedtea/files/jamvm-1.6.0-aarch64-support.patch b/dev-java/icedtea/files/jamvm-1.6.0-aarch64-support.patch @@ -0,0 +1,632 @@ +From a44154f7a18496cc3e5fc0b1b2ea69523ebc623a Mon Sep 17 00:00:00 2001 +From: Simon South <simon@simonsouth.net> +Date: Mon, 1 Jun 2020 07:09:34 -0400 +Subject: [PATCH] Add support for aarch64 on GNU/Linux + +--- + AUTHORS | 1 + + README | 2 +- + configure.ac | 7 +- + src/arch/Makefile.am | 2 +- + src/arch/aarch64.h | 147 +++++++++++++++++++++ + src/jam.c | 3 +- + src/os/linux/Makefile.am | 2 +- + src/os/linux/aarch64/Makefile.am | 28 ++++ + src/os/linux/aarch64/callNative.S | 212 ++++++++++++++++++++++++++++++ + src/os/linux/aarch64/dll_md.c | 59 +++++++++ + src/os/linux/aarch64/init.c | 51 +++++++ + 11 files changed, 508 insertions(+), 6 deletions(-) + create mode 100644 src/arch/aarch64.h + create mode 100644 src/os/linux/aarch64/Makefile.am + create mode 100644 src/os/linux/aarch64/callNative.S + create mode 100644 src/os/linux/aarch64/dll_md.c + create mode 100644 src/os/linux/aarch64/init.c + +diff --git a/AUTHORS b/AUTHORS +index e1334fe..6fd0eeb 100644 +--- jamvm/jamvm/AUTHORS ++++ jamvm/jamvm/AUTHORS +@@ -1,1 +1,2 @@ + Robert Lougher <rob@jamvm.org.uk> ++Simon South <simon@simonsouth.net> +diff --git a/configure.ac b/configure.ac +index 138b7e6..e7051d7 100644 +--- jamvm/jamvm/configure.ac ++++ jamvm/jamvm/configure.ac +@@ -46,6 +46,7 @@ x86_64-*-freebsd*) host_os=bsd libdl_needed=no ;; + arm*-*-linux*) host_cpu=arm host_os=linux interp_cflags=-marm ;; + arm*-*-openbsd*) host_cpu=arm host_os=bsd libdl_needed=no ;; + arm*-*-freebsd*) host_cpu=arm host_os=bsd libdl_needed=no ;; ++aarch64*-*-linux*) host_cpu=aarch64 host_os=linux ;; + powerpc*-*-linux*) host_cpu=powerpc host_os=linux ;; + powerpc*-*-openbsd*) host_cpu=powerpc host_os=bsd libdl_needed=no ;; + powerpc*-*-freebsd*) host_cpu=powerpc host_os=bsd libdl_needed=no ;; +@@ -155,10 +156,11 @@ AC_ARG_ENABLE(runtime-reloc-checks, + + AC_ARG_ENABLE(int-inlining, + [AS_HELP_STRING(--enable-int-inlining,enable inline threaded version of the interpreter +- (by default enabled on x86_64, i386, powerpc, mips and arm, ++ (by default enabled on x86_64, i386, powerpc, mips, arm and aarch64, + disabled otherwise))],, + [if test "$host_cpu" = x86_64 -o "$host_cpu" = i386 -o "$host_cpu" = x86 -o \ +- "$host_cpu" = powerpc -o "$host_cpu" = arm -o "$host_cpu" = mips; then ++ "$host_cpu" = powerpc -o "$host_cpu" = arm -o "$host_cpu" = mips -o \ ++ "$host_cpu" = aarch64; then + enable_int_inlining=yes + else + enable_int_inlining=no +@@ -407,6 +409,7 @@ AC_CONFIG_FILES( + src/os/linux/x86_64/Makefile \ + src/os/linux/parisc/Makefile \ + src/os/linux/mips/Makefile \ ++ src/os/linux/aarch64/Makefile \ + src/os/darwin/i386/Makefile \ + src/os/darwin/arm/Makefile \ + src/os/darwin/powerpc/Makefile \ +diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am +index 7580a1b..4e2a4f9 100644 +--- jamvm/jamvm/src/arch/Makefile.am ++++ jamvm/jamvm/src/arch/Makefile.am +@@ -19,4 +19,4 @@ + ## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + ## + +-EXTRA_DIST = powerpc.h arm.h i386.h x86_64.h parisc.h mips.h sparc.h ++EXTRA_DIST = powerpc.h arm.h i386.h x86_64.h parisc.h mips.h sparc.h aarch64.h +diff --git a/src/arch/aarch64.h b/src/arch/aarch64.h +new file mode 100644 +index 0000000..1912e79 +--- /dev/null ++++ jamvm/jamvm/src/arch/aarch64.h +@@ -0,0 +1,147 @@ ++/* ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 ++ * Robert Lougher <rob@jamvm.org.uk>. ++ * Copyright (C) 2020 Simon South <simon@simonsouth.net>. ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include <stdint.h> ++ ++#define OS_ARCH "aarch64" ++ ++#define HANDLER_TABLE_T static const void ++#define DOUBLE_1_BITS 0x3ff0000000000000LL ++ ++#define READ_DBL(v,p,l) v = ((u8)p[0]<<56)|((u8)p[1]<<48)|((u8)p[2]<<40) \ ++ |((u8)p[3]<<32)|((u8)p[4]<<24)|((u8)p[5]<<16) \ ++ |((u8)p[6]<<8)|(u8)p[7]; p+=8 ++ ++/* Needed for i386 -- empty here */ ++#define FPU_HACK ++ ++#define COMPARE_AND_SWAP_64(addr, old_val, new_val) \ ++({ \ ++ int result, read_val; \ ++ __asm__ __volatile__ (" \ ++ 1: ldaxr %2, %1; \ ++ cmp %2, %3; \ ++ b.ne 2f; \ ++ stlxr %w0, %4, %1; \ ++ cmp %w0, wzr; \ ++ b.ne 1b; \ ++ 2: cset %w0, eq;" \ ++ : "=&r" (result), "+Q" (*addr), "=&r" (read_val) \ ++ : "r" (old_val), "r" (new_val) \ ++ : "cc"); \ ++ result; \ ++}) ++ ++#define COMPARE_AND_SWAP_32(addr, old_val, new_val) \ ++({ \ ++ int result, read_val; \ ++ __asm__ __volatile__ (" \ ++ 1: ldaxr %w2, %1; \ ++ cmp %w2, %w3; \ ++ b.ne 2f; \ ++ stlxr %w0, %w4, %1; \ ++ cmp %w0, wzr; \ ++ b.ne 1b; \ ++ 2: cset %w0, eq;" \ ++ : "=&r" (result), "+Q" (*addr), "=&r" (read_val) \ ++ : "r" (old_val), "r" (new_val) \ ++ : "cc"); \ ++ result; \ ++}) ++ ++#define COMPARE_AND_SWAP(addr, old_val, new_val) \ ++ COMPARE_AND_SWAP_64(addr, old_val, new_val) ++ ++#define LOCKWORD_READ(addr) \ ++({ \ ++ uintptr_t result; \ ++ __asm__ __volatile__ (" \ ++ ldar %0, %1;" \ ++ : "=r" (result) \ ++ : "Q" (*addr) \ ++ : "cc"); \ ++ result; \ ++}) ++ ++#define LOCKWORD_WRITE(addr, value) \ ++({ \ ++ __asm__ __volatile__ (" \ ++ stlr %1, %0;" \ ++ : "=Q" (*addr) \ ++ : "r" (value) \ ++ : "cc"); \ ++}) ++ ++#define LOCKWORD_COMPARE_AND_SWAP(addr, old_val, new_val) \ ++ COMPARE_AND_SWAP_64(addr, old_val, new_val) ++ ++#define FLUSH_CACHE(addr, length) \ ++{ \ ++ uintptr_t start = (uintptr_t) (addr); \ ++ uintptr_t end = start + length; \ ++ uintptr_t i; \ ++ \ ++ for(i = start & aarch64_data_cache_line_mask; \ ++ i < end; \ ++ i += aarch64_data_cache_line_len) \ ++ __asm__ ("dc cvau, %0" :: "r" (i)); \ ++ \ ++ __asm__ ("dsb ish"); \ ++ \ ++ for(i = start & aarch64_instruction_cache_line_mask; \ ++ i < end; \ ++ i += aarch64_instruction_cache_line_len) \ ++ __asm__ ("ic ivau, %0" :: "r" (i)); \ ++ \ ++ __asm__ ("dsb ish; isb"); \ ++} ++ ++#define GEN_REL_JMP(target_addr, patch_addr, patch_size) \ ++({ \ ++ int patched = FALSE; \ ++ \ ++ if(patch_size >= 4) { \ ++ /* Guard against the pointer difference being \ ++ larger than the signed range */ \ ++ long long offset = (uintptr_t)(target_addr) - \ ++ (uintptr_t)(patch_addr); \ ++ \ ++ if(offset >= -1<<28 && offset < 1<<28) { \ ++ *(uint32_t*)(patch_addr) = offset>>2 & 0x03ffffff \ ++ | 0x14000000; \ ++ patched = TRUE; \ ++ } \ ++ } \ ++ patched; \ ++}) ++ ++#define MBARRIER() __asm__ ("dmb ish" ::: "memory") ++#define RMBARRIER() __asm__ ("dmb ishld" ::: "memory") ++#define WMBARRIER() __asm__ ("dmb ishst" ::: "memory") ++#define JMM_LOCK_MBARRIER() __asm__ ("dmb ish" ::: "memory") ++#define JMM_UNLOCK_MBARRIER() JMM_LOCK_MBARRIER() ++ ++/* Defined in src/os/linux/aarch64/init.c */ ++extern unsigned char aarch64_data_cache_line_len; ++extern uintptr_t aarch64_data_cache_line_mask; ++extern unsigned char aarch64_instruction_cache_line_len; ++extern uintptr_t aarch64_instruction_cache_line_mask; +diff --git a/src/jam.c b/src/jam.c +index 052f84a..c97524a 100644 +--- jamvm/jamvm/src/jam.c ++++ jamvm/jamvm/src/jam.c +@@ -98,7 +98,8 @@ void showUsage(char *name) { + void showVersionAndCopyright() { + printf("java version \"%s\"\n", JAVA_COMPAT_VERSION); + printf("JamVM version %s\n", VERSION); +- printf("Copyright (C) 2003-2013 Robert Lougher <rob@jamvm.org.uk>\n\n"); ++ printf("Copyright (C) 2003-2013 Robert Lougher <rob@jamvm.org.uk>\n"); ++ printf("Portions Copyright (C) 2020 Simon South <simon@simonsouth.net>\n\n"); + printf("This program is free software; you can redistribute it and/or\n"); + printf("modify it under the terms of the GNU General Public License\n"); + printf("as published by the Free Software Foundation; either version 2,\n"); +diff --git a/src/os/linux/Makefile.am b/src/os/linux/Makefile.am +index 542094e..83e7dfe 100644 +--- jamvm/jamvm/src/os/linux/Makefile.am ++++ jamvm/jamvm/src/os/linux/Makefile.am +@@ -20,7 +20,7 @@ + ## + + SUBDIRS = @arch@ +-DIST_SUBDIRS = powerpc arm i386 x86_64 parisc mips ++DIST_SUBDIRS = powerpc arm i386 x86_64 parisc mips aarch64 + + noinst_LTLIBRARIES = libos.la + libos_la_SOURCES = os.c +diff --git a/src/os/linux/aarch64/Makefile.am b/src/os/linux/aarch64/Makefile.am +new file mode 100644 +index 0000000..0e5134f +--- /dev/null ++++ jamvm/jamvm/src/os/linux/aarch64/Makefile.am +@@ -0,0 +1,28 @@ ++## ++## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 ++## Robert Lougher <rob@jamvm.org.uk>. ++## ++## File added by Simon South <simon@simonsouth.net>. ++## ++## This file is part of JamVM. ++## ++## This program is free software; you can redistribute it and/or ++## modify it under the terms of the GNU General Public License ++## as published by the Free Software Foundation; either version 2, ++## or (at your option) any later version. ++## ++## This program is distributed in the hope that it will be useful, ++## but WITHOUT ANY WARRANTY; without even the implied warranty of ++## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++## GNU General Public License for more details. ++## ++## You should have received a copy of the GNU General Public License ++## along with this program; if not, write to the Free Software ++## Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++## ++ ++noinst_LTLIBRARIES = libnative.la ++libnative_la_SOURCES = init.c dll_md.c callNative.S ++ ++AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src ++AM_CCASFLAGS = -I$(top_builddir)/src +diff --git a/src/os/linux/aarch64/callNative.S b/src/os/linux/aarch64/callNative.S +new file mode 100644 +index 0000000..e067c4f +--- /dev/null ++++ jamvm/jamvm/src/os/linux/aarch64/callNative.S +@@ -0,0 +1,212 @@ ++/* ++ * Copyright (C) 2008, 2009, 2011, 2012 Robert Lougher <rob@jamvm.org.uk>. ++ * Copyright (C) 2020 Simon South <simon@simonsouth.net>. ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include "config.h" ++ ++#ifndef USE_FFI ++ .text ++ .arch armv8-a ++ .align 2 ++ .global callJNIMethod ++ .type callJNIMethod,function ++ ++/* ++ * Arguments passed in: ++ * ++ * x0 JNIEnv ++ * x1 class or NULL ++ * x2 sig ++ * w3 extra arg ++ * x4 ostack ++ * x5 function pntr ++ * w6 args count ++ */ ++ ++/* Register usage: ++ * ++ * x20 ostack ++ * x19 sig pntr ++ * x16 function pntr ++ * x15 ostack pntr ++ * x14 args pntr ++ * x13 float/double handler ++ * x12 int/long handler ++ * w11 fp regs remaining ++ * w10 int regs remaining ++ * x9 scratch ++ * x2-x7 outgoing int args ++ * x1 outgoing class or this pntr ++ * x0 outgoing JNIEnv (as passed in) ++ * ++ * d0 - d7 outgoing float args ++ */ ++ ++callJNIMethod: ++ stp x29, x30, [sp, #-32]! ++ mov x29, sp ++ stp x19, x20, [x29, #16] ++ ++ sub sp, sp, w3 /* allocate room for stacked args */ ++ mov x14, sp ++ ++ mov x20, x4 /* preserve ostack */ ++ add x19, x2, #1 /* init sig pntr -- skipping '(' */ ++ ++ mov x16, x5 /* save function pntr */ ++ mov x15, x20 /* init ostack pntr */ ++ ++ adr x13, fp_reg_handlers-8 ++ adr x12, int_reg_handlers-8 ++ ++ mov w11, #8 /* fp regs remaining */ ++ mov w10, #6 /* int regs remaining */ ++ ++ cbnz x1, scan_sig /* is method non-static? */ ++ ldr x1, [x15], #8 /* yes, load x1 with "this" */ ++ ++scan_sig: ++ ldrb w9, [x19], #1 /* get next sig char */ ++ ++ cmp w9, #41 /* ')' */ ++ b.eq done ++ ++ cmp w9, #74 /* 'J' */ ++ b.eq long ++ ++ cmp w9, #70 /* 'F' */ ++ b.eq float ++ ++ cmp w9, #68 /* 'D' */ ++ b.eq double ++ ++skip_brackets: ++ cmp w9, #91 /* '[' */ ++ b.ne 1f ++ ldrb w9, [x19], #1 ++ b skip_brackets ++1: ++ cmp w9, #76 /* 'L' */ ++ b.ne int ++ ++skip_ref: ++ ldrb w9, [x19], #1 ++ cmp w9, #59 /* ';' */ ++ b.ne skip_ref ++ ++int: ++ ldr x9, [x15], #8 ++ cbz w10, stack_push ++ ++load_int_reg: ++ sub w10, w10, #1 ++ add x12, x12, #8 ++ br x12 ++ ++int_reg_handlers: ++ mov x2, x9 ++ b scan_sig ++ mov x3, x9 ++ b scan_sig ++ mov x4, x9 ++ b scan_sig ++ mov x5, x9 ++ b scan_sig ++ mov x6, x9 ++ b scan_sig ++ mov x7, x9 ++ b scan_sig ++ ++long: ++ ldr x9, [x15], #16 ++ cbz w10, stack_push ++ b load_int_reg ++ ++float: ++ ldr w9, [x15], #8 ++ cbz w11, stack_push ++ b load_fp_reg ++ ++double: ++ ldr x9, [x15], #16 ++ cbz w11, stack_push ++ ++load_fp_reg: ++ sub w11, w11, #1 ++ add x13, x13, #8 ++ br x13 ++ ++fp_reg_handlers: ++ fmov d0, x9 ++ b scan_sig ++ fmov d1, x9 ++ b scan_sig ++ fmov d2, x9 ++ b scan_sig ++ fmov d3, x9 ++ b scan_sig ++ fmov d4, x9 ++ b scan_sig ++ fmov d5, x9 ++ b scan_sig ++ fmov d6, x9 ++ b scan_sig ++ fmov d7, x9 ++ b scan_sig ++ ++stack_push: ++ str x9, [x14], #8 ++ b scan_sig ++ ++done: ++ /* Call the function */ ++ blr x16 ++ ++ mov sp, x29 /* Pop argument area */ ++ ++ ldrb w9, [x19] /* Return type */ ++ ++ cmp w9, #86 /* 'V' */ ++ b.eq return ++ ++ cmp w9, #68 /* 'D' */ ++ b.ne 2f ++ str d0, [x20], #16 ++ b return ++2: ++ cmp w9, #70 /* 'F' */ ++ b.ne 3f ++ str s0, [x20], #8 ++ b return ++3: ++ cmp w9, #74 /* 'J' */ ++ b.ne 4f ++ str x0, [x20], #16 ++ b return ++4: ++ str x0, [x20], #8 ++ ++return: ++ mov x0, x20 /* return ostack */ ++ ++ ldp x19, x20, [x29, #16] ++ ldp x29, x30, [sp], #32 ++ ret ++#endif +diff --git a/src/os/linux/aarch64/dll_md.c b/src/os/linux/aarch64/dll_md.c +new file mode 100644 +index 0000000..189f8a8 +--- /dev/null ++++ jamvm/jamvm/src/os/linux/aarch64/dll_md.c +@@ -0,0 +1,59 @@ ++/* ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011 ++ * Robert Lougher <rob@jamvm.org.uk>. ++ * Copyright (C) 2020 Simon South <simon@simonsouth.net>. ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include "jam.h" ++ ++#ifndef USE_FFI ++ ++int nativeExtraArg(MethodBlock *mb) { ++ char *sig = mb->type; ++ int stack_args = 0; ++ int int_args = 6; ++ int fp_args = 8; ++ ++ while(*++sig != ')') ++ switch(*sig) { ++ case 'F': ++ case 'D': ++ if(fp_args == 0) ++ stack_args += 8; ++ else ++ fp_args--; ++ ++ default: ++ if(int_args == 0) ++ stack_args += 8; ++ else ++ int_args--; ++ ++ if(*sig == '[') ++ while(*++sig == '['); ++ if(*sig == 'L') ++ while(*++sig != ';'); ++ break; ++ } ++ ++ /* Ensure the stack remains 16 byte aligned. */ ++ return (stack_args + 15) & ~15; ++} ++ ++#endif +diff --git a/src/os/linux/aarch64/init.c b/src/os/linux/aarch64/init.c +new file mode 100644 +index 0000000..b21dc55 +--- /dev/null ++++ jamvm/jamvm/src/os/linux/aarch64/init.c +@@ -0,0 +1,51 @@ ++/* ++ * Copyright (C) 2003, 2004, 2005, 2006, 2007 ++ * Robert Lougher <rob@jamvm.org.uk>. ++ * Copyright (C) 2020 Simon South <simon@simonsouth.net>. ++ * ++ * This file is part of JamVM. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version 2, ++ * or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ++ */ ++ ++#include "arch/aarch64.h" ++ ++/* Length in bytes of the smallest line in the host system's data cache */ ++unsigned char aarch64_data_cache_line_len; ++ ++/* Mask used to align a virtual address to a line in the data cache */ ++uintptr_t aarch64_data_cache_line_mask; ++ ++/* Length in bytes of the smallest line in the host system's instruction ++ cache */ ++unsigned char aarch64_instruction_cache_line_len; ++ ++/* Mask used to align a virtual address to a line in the instruction cache */ ++uintptr_t aarch64_instruction_cache_line_mask; ++ ++void initialisePlatform() { ++ unsigned int cache_type; ++ ++ /* Extract information from the cache-type register, which describes aspects ++ of the host's cache configuration */ ++ __asm__ ("mrs %0, ctr_el0" : "=r" (cache_type)); ++ ++ aarch64_data_cache_line_len = 4 << ((cache_type >> 16) & 0x0f); ++ aarch64_data_cache_line_mask = ~(aarch64_data_cache_line_len - 1); ++ ++ aarch64_instruction_cache_line_len = 4 << (cache_type & 0x0f); ++ aarch64_instruction_cache_line_mask = ++ ~(aarch64_instruction_cache_line_len - 1); ++} +-- +2.26.2 + diff --git a/dev-java/icedtea/files/jamvm-1.6.0-opcode-guard.patch b/dev-java/icedtea/files/jamvm-1.6.0-opcode-guard.patch @@ -0,0 +1,35 @@ +From ca11b53896365c948426974cb90e8f71c70d123b Mon Sep 17 00:00:00 2001 +From: Simon South <simon@simonsouth.net> +Date: Sun, 31 May 2020 20:36:43 -0400 +Subject: [PATCH] Guard floating-point opcodes with explicit memory barrier + +--- + src/interp/engine/interp-inlining.h | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/src/interp/engine/interp-inlining.h b/src/interp/engine/interp-inlining.h +index 3339b0e..4ee5c5a 100644 +--- jamvm/jamvm/src/interp/engine/interp-inlining.h ++++ jamvm/jamvm/src/interp/engine/interp-inlining.h +@@ -78,8 +78,17 @@ + 4.3, we need to insert a label, and ensure its address + is taken (to stop it being optimised out). However, + this reduces performance on PowerPC by approx 1 - 2%. ++ ++ With gcc 5 and newer an asm statement with a "memory" ++ clobber argument explicitly sets a memory barrier for the ++ compiler, preventing it from reordering memory accesses ++ in a way that breaks decaching. + */ +-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) ++#if (__GNUC__ > 4) ++#define DEF_GUARD_TABLE(level) /* none */ ++#define GUARD(opcode, level) __asm__("" ::: "memory"); ++#define GUARD_TBLS /* none */ ++#elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) + #define DEF_GUARD_TABLE(level) DEF_HANDLER_TABLE(level, GUARD) + #define GUARD(opcode, level) label(opcode, level, GUARD) + #define GUARD_TBLS , HNDLR_TBLS(GUARD) +-- +2.26.2 + diff --git a/dev-java/icedtea/icedtea-7.2.6.28.ebuild b/dev-java/icedtea/icedtea-7.2.6.28.ebuild @@ -0,0 +1,402 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 +# Build written by Andrew John Hughes (gnu_andrew@member.fsf.org) + +EAPI="6" +SLOT="7" + +inherit autotools check-reqs eutils gnome2-utils java-pkg-2 java-vm-2 multiprocessing pax-utils prefix versionator virtualx + +ICEDTEA_VER=$(get_version_component_range 2-4) +ICEDTEA_BRANCH=$(get_version_component_range 2-3) +ICEDTEA_PKG=icedtea-${ICEDTEA_VER} +ICEDTEA_PRE=$(get_version_component_range _) +CORBA_TARBALL="60fb55621427.tar.bz2" +HOTSPOT_TARBALL="d7f4f4901aa1.tar.bz2" +JAXP_TARBALL="2eedd3512498.tar.bz2" +JAXWS_TARBALL="dc69e332d99f.tar.bz2" +JDK_TARBALL="f42b7efa98fe.tar.bz2" +LANGTOOLS_TARBALL="9cf0f33fe118.tar.bz2" +OPENJDK_TARBALL="b7da16493c1b.tar.bz2" + +CACAO_TARBALL="cacao-c182f119eaad.tar.gz" +JAMVM_TARBALL="jamvm-ec18fb9e49e62dce16c5094ef1527eed619463aa.tar.gz" + +CORBA_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-corba-${CORBA_TARBALL}" +JAXP_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-jaxp-${JAXP_TARBALL}" +JAXWS_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-jaxws-${JAXWS_TARBALL}" +JDK_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-jdk-${JDK_TARBALL}" +LANGTOOLS_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-langtools-${LANGTOOLS_TARBALL}" +OPENJDK_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-openjdk-${OPENJDK_TARBALL}" +HOTSPOT_GENTOO_TARBALL="icedtea-${ICEDTEA_BRANCH}-hotspot-${HOTSPOT_TARBALL}" + +CACAO_GENTOO_TARBALL="icedtea-${CACAO_TARBALL}" +JAMVM_GENTOO_TARBALL="icedtea-${JAMVM_TARBALL}" + +DROP_URL="https://icedtea.classpath.org/download/drops" +ICEDTEA_URL="${DROP_URL}/icedtea${SLOT}/${ICEDTEA_VER}" + +DESCRIPTION="A harness to build OpenJDK using Free Software build tools and dependencies" +HOMEPAGE="https://icedtea.classpath.org" +SRC_PKG="${ICEDTEA_PKG}.tar.xz" +SRC_URI=" + https://icedtea.classpath.org/download/source/${SRC_PKG} + ${ICEDTEA_URL}/openjdk.tar.bz2 -> ${OPENJDK_GENTOO_TARBALL} + ${ICEDTEA_URL}/corba.tar.bz2 -> ${CORBA_GENTOO_TARBALL} + ${ICEDTEA_URL}/jaxp.tar.bz2 -> ${JAXP_GENTOO_TARBALL} + ${ICEDTEA_URL}/jaxws.tar.bz2 -> ${JAXWS_GENTOO_TARBALL} + ${ICEDTEA_URL}/jdk.tar.bz2 -> ${JDK_GENTOO_TARBALL} + ${ICEDTEA_URL}/hotspot.tar.bz2 -> ${HOTSPOT_GENTOO_TARBALL} + ${ICEDTEA_URL}/langtools.tar.bz2 -> ${LANGTOOLS_GENTOO_TARBALL} + ${DROP_URL}/cacao/${CACAO_TARBALL} -> ${CACAO_GENTOO_TARBALL} + ${DROP_URL}/jamvm/${JAMVM_TARBALL} -> ${JAMVM_GENTOO_TARBALL}" + +LICENSE="Apache-1.1 Apache-2.0 GPL-1 GPL-2 GPL-2-with-linking-exception LGPL-2 MPL-1.0 MPL-1.1 public-domain W3C" +KEYWORDS="amd64 arm64" + +IUSE="+alsa cacao +cups debug doc examples +gtk headless-awt + jamvm +jbootstrap kerberos libressl nss pax_kernel + sctp selinux smartcard source test zero" + +REQUIRED_USE="gtk? ( !headless-awt )" + +# Ideally the following were optional at build time. +ALSA_COMMON_DEP=" + >=media-libs/alsa-lib-1.0" +CUPS_COMMON_DEP=" + >=net-print/cups-1.2.12" +X_COMMON_DEP=" + >=media-libs/giflib-4.1.6:= + >=media-libs/libpng-1.2:0= + >=x11-libs/libX11-1.1.3 + >=x11-libs/libXext-1.1.1 + >=x11-libs/libXi-1.1.3 + >=x11-libs/libXrender-0.9.4 + >=x11-libs/libXtst-1.0.3 + x11-libs/libXt + x11-libs/libXcomposite" +X_DEPEND=" + >=x11-libs/libXau-1.0.3 + >=x11-libs/libXdmcp-1.0.2 + >=x11-libs/libXinerama-1.0.2 + x11-base/xorg-proto" + +COMMON_DEP=" + app-misc/mime-types + >=dev-libs/glib-2.26:2 + media-libs/fontconfig + >=media-libs/freetype-2.10.1:2= + >=media-libs/lcms-2.5 + >=sys-libs/zlib-1.2.3:= + virtual/jpeg:0= + gtk? ( + >=dev-libs/atk-1.30.0 + >=x11-libs/cairo-1.8.8:= + x11-libs/gdk-pixbuf:2 + >=x11-libs/gtk+-2.8:2= + >=x11-libs/pango-1.24.5 + ) + kerberos? ( virtual/krb5 ) + nss? ( >=dev-libs/nss-3.12.5-r1 ) + sctp? ( net-misc/lksctp-tools ) + smartcard? ( sys-apps/pcsc-lite )" + +# gsettings-desktop-schemas is needed for native proxy support. #431972 +RDEPEND="${COMMON_DEP} + !dev-java/icedtea:0 + !dev-java/icedtea-web:7 + >=gnome-base/gsettings-desktop-schemas-3.12.2 + media-fonts/dejavu + alsa? ( ${ALSA_COMMON_DEP} ) + cups? ( ${CUPS_COMMON_DEP} ) + !headless-awt? ( ${X_COMMON_DEP} ) + selinux? ( sec-policy/selinux-java )" + +# Only ant-core-1.8.1 has fixed ant -diagnostics when xerces+xalan are not present. +# ca-certificates, perl and openssl are used for the cacerts keystore generation +DEPEND="${COMMON_DEP} ${ALSA_COMMON_DEP} ${CUPS_COMMON_DEP} ${X_COMMON_DEP} ${X_DEPEND} + || ( + dev-java/jamvm:2.0-3 + dev-java/icedtea:7 + ) + sys-devel/automake:1.16 + app-arch/cpio + app-arch/unzip + app-arch/zip + app-misc/ca-certificates + dev-java/ant-core:bootstrap + dev-lang/perl + >=dev-libs/libxslt-1.1.26 + !libressl? ( dev-libs/openssl ) + libressl? ( dev-libs/libressl ) + sys-apps/attr + sys-apps/lsb-release + virtual/pkgconfig + pax_kernel? ( sys-apps/elfix )" + +S="${WORKDIR}"/${ICEDTEA_PKG} + +icedtea_check_requirements() { + local CHECKREQS_DISK_BUILD + + if use doc; then + CHECKREQS_DISK_BUILD="9000M" + else + CHECKREQS_DISK_BUILD="8500M" + fi + + check-reqs_pkg_${EBUILD_PHASE} +} + +pkg_pretend() { + icedtea_check_requirements +} + +pkg_setup() { + icedtea_check_requirements + + JAVA_PKG_WANT_BUILD_VM="jamvm-2.0-3 icedtea-7" + JAVA_PKG_WANT_SOURCE="1.5" + JAVA_PKG_WANT_TARGET="1.5" + + java-vm-2_pkg_setup + java-pkg-2_pkg_setup +} + +src_unpack() { + unpack ${SRC_PKG} + + ln -s "${FILESDIR}/jamvm-1.6.0-aarch64-support.patch" "${S}/patches/jamvm" || die + ln -s "${FILESDIR}/jamvm-1.6.0-opcode-guard.patch" "${S}/patches/jamvm" || die + ln -s "${FILESDIR}/${PN}-jdk-musl.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}-jdk-no-soname.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}-jdk-fix-build.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}-jdk-execinfo.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}-hotspot-stop-using-obsolete-isnanf.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}${SLOT}-jdk-freetype.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}${SLOT}-hotspot-pointer-comparison.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}${SLOT}-jdk-fcommon.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}${SLOT}-hotspot-miscompile.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}-hotspot-musl.patch" "${S}/patches" || die + ln -s "${FILESDIR}/${PN}-os_linux-remove-glibc-dependencies.patch" "${S}/patches" || die +} + +src_prepare() { + default + sed -i 's/REQUIRED_FREETYPE_VERSION = 2.2.1/REQUIRED_FREETYPE_VERSION = 2.10.1/' patches/boot/revert-6973616.patch + + #eapply "${FILESDIR}/${PN}${SLOT}-disable-systemtap.patch" + eautoreconf +} + +src_configure() { + export ANT_HOME="${EPREFIX}/usr/share/ant" + + # For bootstrap builds as the sandbox control file might not yet exist. + addpredict /proc/self/coredump_filter + + # icedtea doesn't like some locales. #330433 #389717 + export LANG="C" LC_ALL="C" + + local cacao_config config hotspot_port jamvm_config use_cacao use_jamvm use_zero zero_config + local vm=$(java-pkg_get-current-vm) + + # Export patches for configure + DISTRIBUTION_PATCHES="" + + if use jamvm; then + DISTRIBUTION_PATCHES+="patches/jamvm/jamvm-1.6.0-aarch64-support.patch " + DISTRIBUTION_PATCHES+="patches/jamvm/jamvm-1.6.0-opcode-guard.patch " + fi + + DISTRIBUTION_PATCHES+="patches/${PN}-jdk-musl.patch " + DISTRIBUTION_PATCHES+="patches/${PN}-jdk-no-soname.patch " + DISTRIBUTION_PATCHES+="patches/${PN}-jdk-fix-build.patch " + DISTRIBUTION_PATCHES+="patches/${PN}-jdk-execinfo.patch " + DISTRIBUTION_PATCHES+="patches/${PN}-hotspot-stop-using-obsolete-isnanf.patch " + DISTRIBUTION_PATCHES+="patches/${PN}${SLOT}-jdk-freetype.patch " + DISTRIBUTION_PATCHES+="patches/${PN}${SLOT}-jdk-fcommon.patch " + DISTRIBUTION_PATCHES+="patches/${PN}${SLOT}-hotspot-pointer-comparison.patch " + DISTRIBUTION_PATCHES+="patches/${PN}${SLOT}-hotspot-miscompile.patch " + DISTRIBUTION_PATCHES+="patches/${PN}-hotspot-musl.patch " + DISTRIBUTION_PATCHES+="patches/${PN}-os_linux-remove-glibc-dependencies.patch " + + export DISTRIBUTION_PATCHES + + # gcj-jdk ensures ecj is present. + if use jbootstrap || has "${vm}" jamvm-2.0-3; then + use jbootstrap || einfo "bootstrap is necessary when building with ${vm}, ignoring USE=\"-jbootstrap\"" + config+=" --enable-bootstrap" + else + config+=" --disable-bootstrap" + fi + + # Use Zero if requested + if use zero; then + use_zero="yes" + fi + + # Use JamVM if requested + if use jamvm; then + use_jamvm="yes" + fi + + # Use CACAO if requested + if use cacao; then + use_cacao="yes" + fi + + # Are we on a architecture with a HotSpot port? + # In-tree JIT ports are available for amd64, arm, arm64, ppc64 (be&le), SPARC and x86. + if { use amd64 || use arm || use ppc64 || use sparc || use x86; }; then + hotspot_port="yes" + fi + + # Always use HotSpot as the primary VM if available. #389521 #368669 #357633 ... + # Otherwise use CACAO on ppc and Zero on anything else + if test "x${hotspot_port}" != "xyes"; then + if use ppc; then + use_cacao="yes" + else + use_zero="yes" + fi + fi + + if test "x${use_jamvm}" = "xyes"; then + jamvm_config="--enable-jamvm" + fi + + # Turn on CACAO if needed (non-HS archs) or requested + if test "x${use_cacao}" = "xyes"; then + if test "x${hotspot_port}" = "xyes"; then + ewarn 'Enabling CACAO on an architecture with HotSpot support; issues may result.' + ewarn 'If so, please rebuild with USE="-cacao"' + fi + cacao_config="--enable-cacao" + fi + + # Turn on Zero if needed (non-HS/CACAO archs) or requested + if test "x${use_zero}" = "xyes"; then + if test "x${hotspot_port}" = "xyes"; then + ewarn 'Enabling Zero on an architecture with HotSpot support; performance will be significantly reduced.' + fi + zero_config="--enable-zero" + fi + + config+=" --with-parallel-jobs=$(makeopts_jobs)" + config+=" --without-rhino" + + unset JAVA_HOME JDK_HOME CLASSPATH JAVAC JAVACFLAGS + + econf ${config} \ + --with-openjdk-src-zip="${DISTDIR}/${OPENJDK_GENTOO_TARBALL}" \ + --with-corba-src-zip="${DISTDIR}/${CORBA_GENTOO_TARBALL}" \ + --with-jaxp-src-zip="${DISTDIR}/${JAXP_GENTOO_TARBALL}" \ + --with-jaxws-src-zip="${DISTDIR}/${JAXWS_GENTOO_TARBALL}" \ + --with-jdk-src-zip="${DISTDIR}/${JDK_GENTOO_TARBALL}" \ + --with-hotspot-src-zip="${DISTDIR}/${HOTSPOT_GENTOO_TARBALL}" \ + --with-langtools-src-zip="${DISTDIR}/${LANGTOOLS_GENTOO_TARBALL}" \ + --with-cacao-src-zip="${DISTDIR}/${CACAO_GENTOO_TARBALL}" \ + --with-jamvm-src-zip="${DISTDIR}/${JAMVM_GENTOO_TARBALL}" \ + --with-jdk-home="$(java-config -O)" \ + --prefix="${EPREFIX}/usr/$(get_libdir)/icedtea${SLOT}" \ + --mandir="${EPREFIX}/usr/$(get_libdir)/icedtea${SLOT}/man" \ + --docdir="${EPREFIX}/usr/share/doc/${PF}" \ + --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \ + --with-pkgversion="Gentoo ${PF}" \ + --disable-downloading --disable-Werror --disable-tests \ + --enable-system-lcms --enable-system-jpeg \ + --enable-system-zlib --disable-systemtap-tests \ + --enable-improved-font-rendering \ + $(use_enable !headless-awt system-gif) \ + $(use_enable !headless-awt system-png) \ + $(use_enable !debug optimizations) \ + $(use_enable cups system-cups) \ + $(use_enable doc docs) \ + $(use_enable gtk system-gtk) \ + $(use_enable kerberos system-kerberos) \ + $(use_enable nss) \ + $(use_with pax_kernel pax "${EPREFIX}/usr/sbin/paxmark.sh") \ + $(use_enable sctp system-sctp) \ + $(use_enable smartcard system-pcsc) \ + ${zero_config} ${cacao_config} ${jamvm_config} +} + +src_compile() { + # Would use GENTOO_VM otherwise. + export ANT_RESPECT_JAVA_HOME=TRUE + + # With ant >=1.8.2 all required tasks are part of ant-core + export ANT_TASKS="none" + + export DISABLE_HOTSPOT_OS_VERSION_CHECK=ok + + emake +} + +src_test() { + # Use Xvfb for tests + unset DISPLAY + + Xemake check +} + +src_install() { + default + + local dest="${EPREFIX}/usr/$(get_libdir)/icedtea${SLOT}" + local ddest="${ED}${dest#/}" + + if ! use alsa; then + rm -v "${ddest}"/jre/lib/$(get_system_arch)/libjsoundalsa.* || die + fi + + if use headless-awt; then + rm -vr "${ddest}"/jre/lib/$(get_system_arch)/{xawt,libsplashscreen.*,libjavagtk.*} \ + "${ddest}"/{,jre/}bin/policytool "${ddest}"/bin/appletviewer || die + fi + + if ! use examples; then + rm -r "${ddest}"/demo "${ddest}"/sample || die + fi + + if ! use source; then + rm -v "${ddest}"/src.zip || die + fi + + dosym /usr/share/doc/${PF} /usr/share/doc/${PN}${SLOT} + + # Fix the permissions. + find "${ddest}" \! -type l \( -perm /111 -exec chmod 755 {} \; -o -exec chmod 644 {} \; \) || die + + # We need to generate keystore - bug #273306 + einfo "Generating cacerts file from certificates in ${EPREFIX}/usr/share/ca-certificates/" + mkdir "${T}/certgen" && cd "${T}/certgen" || die + cp "${FILESDIR}/generate-cacerts.pl" . && chmod +x generate-cacerts.pl || die + for c in "${EPREFIX}"/usr/share/ca-certificates/*/*.crt; do + openssl x509 -text -in "${c}" >> all.crt || die + done + ./generate-cacerts.pl "${ddest}/bin/keytool" all.crt || die + cp -vRP cacerts "${ddest}/jre/lib/security/" || die + chmod 644 "${ddest}/jre/lib/security/cacerts" || die + + java-vm_install-env "${FILESDIR}/icedtea.env.sh" + java-vm_sandbox-predict /proc/self/coredump_filter +} + +pkg_preinst() { + if has_version "<=dev-java/icedtea-7.2.0:7"; then + # portage would preserve the symlink otherwise, related to bug #384397 + rm -f "${EROOT}/usr/lib/jvm/icedtea7" + elog "To unify the layout and simplify scripts, the identifier of Icedtea-7*" + elog "has changed from 'icedtea7' to 'icedtea-7' starting from version 7.2.0-r1" + elog "If you had icedtea7 as system VM, the change should be automatic, however" + elog "build VM settings in /etc/java-config-2/build/jdk.conf are not changed" + elog "and the same holds for any user VM settings. Sorry for the inconvenience." + fi + + gnome2_icon_savelist; +} + +pkg_postinst() { gnome2_icon_cache_update; } +pkg_postrm() { gnome2_icon_cache_update; }