tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Can't build lang/openjdk{17,21} on NetBSD/aarch64 (Apple M3)



On 7/11/25 18:48, PHO wrote:
Hi,

I have a hard time trying to build lang/openjdk17 on NetBSD/aarch64 10. This is on a VMware guest running on Apple M3 iMac:

Replying to myself. I have investigated this further and it was even more confusing. I tried several other versions of OpenJDK. This is the result:

- lang/openjdk8: Works properly!
- lang/openjdk11: Dies with SIGILL but only sometimes. Not consistently.
- lang/openjdk17: Immediately dies with SIGILL, even "java --version" dies.
- lang/openjdk21: Same as 17.

On openjdk21 the java VM dies with this signal:

siginfo: si_signo: 4 (SIGILL), si_code: 4 (ILL_ILLTRP), si_addr: 0x0000f512ca8a12d4

This is the disassembled JIT-compiled code produced by openjdk21:

   0x0000f512ca8a12d4:  add     x0, x24, #0x0
   0x0000f512ca8a12d8:  mov     x2, #0x0                        // #0
   0x0000f512ca8a12dc:  ldr     x8, [x0]
   0x0000f512ca8a12e0:  cbz     x8, 0xf512ca8a12e8
   0x0000f512ca8a12e4:  mov     x2, x0
   0x0000f512ca8a12e8:  mov     x0, #0x4970                     // #18800
   0x0000f512ca8a12ec:  movk    x0, #0xca86, lsl #16
   0x0000f512ca8a12f0:  movk    x0, #0xf512, lsl #32
   0x0000f512ca8a12f4:  ret

The SIGILL happens at 0x0000f512ca8a12d4, i.e. this instruction:

   0x0000f512ca8a12d4:  add     x0, x24, #0x0

But hey, it's just a normal ADD between registers and an immediate value. How on earth is it illegal? Now I'm beginning to suspect the kernel is reporting an incorrect si_addr.

Home | Main Index | Thread Index | Old Index