battleblow / openjdk-jdk11u

BSD port of OpenJDK 11
GNU General Public License v2.0
9 stars 8 forks source link

Support FreeBSD < 12.1 aarch64 #67

Closed klaus4 closed 5 years ago

klaus4 commented 5 years ago

although not yet tested under FreeBSD-versions > 12.0 it should not break compiling there

MikaelUrankar commented 5 years ago

openjdk11 doesn't work on 12.0-release (due to some rtld bugs that have been fixed in 12-stable and -current). andrew@ will probably mfc 350112, 350241 and 350242. I also asked manu@ if he can mfc 350166.

klaus4 commented 5 years ago

requested changes for HWCAP now made in commit : https://github.com/battleblow/openjdk-jdk11u/pull/67/commits/3ea14e4d6fe2e95e663f9ceee810e2788ace46e9 test-build was successfully

Do you agree to leave the following that way?

/* FreeBSD 12.0-STABLE(as of 2019-08-14) */
  #if defined(ID_AA64PFR0_ADV_SIMD)
  if (ID_AA64PFR0_ADV_SIMD(id_aa64pfr0) == ID_AA64PFR0_ADV_SIMD_IMPL || \
          ID_AA64PFR0_ADV_SIMD(id_aa64pfr0) == ID_AA64PFR0_ADV_SIMD_HP ) {
    auxv = auxv | HWCAP_ASIMD;
      }
    /* FreeBSD ≥ 12.1 */
    #elif defined(ID_AA64PFR0_AdvSIMD)
    if (ID_AA64PFR0_AdvSIMD(id_aa64pfr0) == ID_AA64PFR0_AdvSIMD_IMPL || \
      ID_AA64PFR0_AdvSIMD(id_aa64pfr0) == ID_AA64PFR0_AdvSIMD_HP ) {
    auxv = auxv | HWCAP_ASIMD;
  }
  #endif

I think the whole aarch64 Tier 2 for FreeBSD is currently a daily hack. But we started with it and anything that helps support openjdk11 on publicly available OS versions (and does no harm to the codebase) should be done. Correct me if you have a different opinion of openjdk11/aarch64

klaus4 commented 5 years ago

openjdk11 doesn't work on 12.0-release (due to some rtld bugs that have been fixed in 12-stable and -current). andrew@ will probably mfc 350112, 350241 and 350242. I also asked manu@ if he can mfc 350166.

that makes sense. But afaik freebsd-update isn't supported on Tier 2 platforms(I didn't try yet under 12.0-STABLE).

bsdkurt commented 5 years ago

requested changes for HWCAP now made in commit : 3ea14e4 test-build was successfully

Do you agree to leave the following that way?

/* FreeBSD 12.0-STABLE(as of 2019-08-14) */
  #if defined(ID_AA64PFR0_ADV_SIMD)
  if (ID_AA64PFR0_ADV_SIMD(id_aa64pfr0) == ID_AA64PFR0_ADV_SIMD_IMPL || \
        ID_AA64PFR0_ADV_SIMD(id_aa64pfr0) == ID_AA64PFR0_ADV_SIMD_HP ) {
    auxv = auxv | HWCAP_ASIMD;
    }
  /* FreeBSD ≥ 12.1 */
  #elif defined(ID_AA64PFR0_AdvSIMD)
  if (ID_AA64PFR0_AdvSIMD(id_aa64pfr0) == ID_AA64PFR0_AdvSIMD_IMPL || \
      ID_AA64PFR0_AdvSIMD(id_aa64pfr0) == ID_AA64PFR0_AdvSIMD_HP ) {
    auxv = auxv | HWCAP_ASIMD;
  }
  #endif

I think the whole aarch64 Tier 2 for FreeBSD is currently a daily hack. But we started with it and anything that helps support openjdk11 on publicly available OS versions (and does no harm to the codebase) should be done. Correct me if you have a different opinion of openjdk11/aarch64

Please restore this chunk of code back to what is currently in bsd-port and add backwards compat defines at the top:

#ifndef ID_AA64PFR0_AdvSIMD_SHIFT
#define ID_AA64PFR0_AdvSIMD_SHIFT 20
#endif

#ifndef ID_AA64PFR0_AdvSIMD
#define ID_AA64PFR0_AdvSIMD(x) ((x) & (UL(0xf) << ID_AA64PFR0_AdvSIMD_SHIFT))
#endif

#ifndef ID_AA64PFR0_AdvSIMD_IMPL
#define ID_AA64PFR0_AdvSIMD_IMPL (UL(0x0) << ID_AA64PFR0_AdvSIMD_SHIFT)
#endif

#ifndef ID_AA64PFR0_AdvSIMD_HP
#define ID_AA64PFR0_AdvSIMD_HP (UL(0x1) << ID_AA64PFR0_AdvSIMD_SHIFT)
#endif

This should work pre 12.1 and also be helpful to OpenBSD when I get around to adding support for it later.

bsdkurt commented 5 years ago

git diff bsd-port -- src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp may be helpful to see what you have changed relative to bsd-port branch.

klaus4 commented 5 years ago

git diff bsd-port -- src/hotspot/os_cpu/bsd_aarch64/vm_version_bsd_aarch64.cpp may be helpful to see what you have changed relative to bsd-port branch.

holy s*it, you`re right :-), https://github.com/battleblow/openjdk-jdk11u/pull/67/commits/76dd633a5c76f6279951a1693c0c04fd6663837b now O.K ?

klaus4 commented 5 years ago

<< This should work pre 12.1 and also be helpful to OpenBSD when I get around to adding support for it later.>> I have OpenBSD running on a Rock64 board. Do you have any idea how to create a bootstrap jdk? Do we need to apply your revolutionary :-) NFS export method or is there a way to make the FreeBSD bootstraps ELF compliant?

bsdkurt commented 5 years ago

<< This should work pre 12.1 and also be helpful to OpenBSD when I get around to adding support for it later.>> I have OpenBSD running on a Rock64 board. Do you have any idea how to create a bootstrap jdk? Do we need to apply your revolutionary :-) NFS export method or is there a way to make the FreeBSD bootstraps ELF compliant?

I would recommend using the NFS export method for initial bootstrap jdk.

battleblow commented 5 years ago

LGTM. @MikaelUrankar @battleblow are you okay with the current state?

No objections from me. Feel free to merge if Mikael is ok :)

I will try and get an AWS EC2 instance running FreeBSD set up sometime soon.

klaus4 commented 5 years ago

<< I will try and get an AWS EC2 instance running FreeBSD set up sometime soon.>>

For the sake of correctness, I'll do a test compile with the new changes under 12.0-STABLE on EC2, in an hour or so. .

there is an NetBSD/aarch64 AMI available on EC2, for OpenBSD aarch64 I didn`t find one yet.

MikaelUrankar commented 5 years ago

LGTM. @MikaelUrankar @battleblow are you okay with the current state?

Yes