ldc icon indicating copy to clipboard operation
ldc copied to clipboard

S390x: add preliminary support for SystemZ

Open liushuyu opened this issue 1 year ago • 11 comments

This pull request adds preliminary support for IBM Z systems (running in z/Architecture mode).

liushuyu avatar Jan 01 '25 05:01 liushuyu

Thank you for bringing it to our attention. We will check internally and confirm.

Gayathri-Berli avatar Jan 03 '25 14:01 Gayathri-Berli

Many thanks for working on the SystemZ port! I'll have a look at the details.

uweigand avatar Jan 07 '25 08:01 uweigand

I tried to build this on s390x on Fedora rawhide, using gdc as a bootstrap compiler and ran into the following error:

core/thread/osthread.d(1648): Error: cannot implicitly convert expression `regs[9]` of type `ulong` to `void*`
core/thread/osthread.d(1648): Error: cannot implicitly convert expression `regs[9]` of type `ulong` to `void*`
core/thread/osthread.d(1648): Error: cannot implicitly convert expression `regs[9]` of type `ulong` to `void*`
core/thread/osthread.d(1648): Error: cannot implicitly convert expression `regs[9]` of type `ulong` to `void*`

Any ideas what's going on?

kalev avatar Jan 09 '25 14:01 kalev

I tried to build this on s390x on Fedora rawhide, using gdc as a bootstrap compiler and ran into the following error:

core/thread/osthread.d(1648): Error: cannot implicitly convert expression `regs[9]` of type `ulong` to `void*`
core/thread/osthread.d(1648): Error: cannot implicitly convert expression `regs[9]` of type `ulong` to `void*`
core/thread/osthread.d(1648): Error: cannot implicitly convert expression `regs[9]` of type `ulong` to `void*`
core/thread/osthread.d(1648): Error: cannot implicitly convert expression `regs[9]` of type `ulong` to `void*`

Any ideas what's going on?

This is now fixed.

liushuyu avatar Jan 09 '25 16:01 liushuyu

Thanks! With this, I was able to build an initial version of ldc (using gdc), but when I try to build ldc with itself, it now fails with the following:

/usr/bin/ld: lib64/libldc.a(asmstmt.cpp.o)(.text+0x1d02): misaligned symbol `_ZN3Loc12messageStyleE' (0x1efc009) for relocation R_390_PC32DBL
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status

kalev avatar Jan 09 '25 18:01 kalev

Wrt. SystemZ CI, we apparently could

  1. apply for a free VM from IBM: https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/
  2. install a GitHub Actions runner on it: https://github.com/anup-kodlekere/gaplib
  3. target it in our GHA YAML (using GDC as host compiler for now), to see how bad the test failures are

kinke avatar Jan 16 '25 11:01 kinke

Wrt. SystemZ CI, we apparently could

1. apply for a free VM from IBM: https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/

2. install a GitHub Actions runner on it: https://github.com/anup-kodlekere/gaplib

3. target it in our GHA YAML (using GDC as host compiler for now), to see how bad the test failures are

Yes, that would definitely be an option - that is the intended purpose of those VMs we make available.

As an alternative, some projects go the route of running SystemZ tests under qemu (see e.g. https://github.com/bytecodealliance/wasmtime/blob/main/.github/workflows/main.yml). For performance reasons, in this case it might be preferable to run the compiler natively (as cross-compiler) and only run the resulting test cases in qemu.

uweigand avatar Jan 17 '25 13:01 uweigand

Wrt. SystemZ CI, we apparently could

1. apply for a free VM from IBM: https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/

2. install a GitHub Actions runner on it: https://github.com/anup-kodlekere/gaplib

3. target it in our GHA YAML (using GDC as host compiler for now), to see how bad the test failures are

Yes, that would definitely be an option - that is the intended purpose of those VMs we make available.

Is that a task you are willing to pick up? Thanks!

JohanEngelen avatar Jan 19 '25 16:01 JohanEngelen

Wrt. SystemZ CI, we apparently could

1. apply for a free VM from IBM: https://community.ibm.com/zsystems/form/l1cc-oss-vm-request/

2. install a GitHub Actions runner on it: https://github.com/anup-kodlekere/gaplib

3. target it in our GHA YAML (using GDC as host compiler for now), to see how bad the test failures are

Yes, that would definitely be an option - that is the intended purpose of those VMs we make available.

Is that a task you are willing to pick up? Thanks!

I could certainly set up the machine and the Actions runner. For integration with your CI I'd probably need help from someone who understands its current setup ...

uweigand avatar Jan 20 '25 13:01 uweigand

I could certainly set up the machine and the Actions runner.

Thanks, that'd be great!

For integration with your CI I'd probably need help from someone who understands its current setup ...

No worries, once we have a registered runner, we can take over. According to https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners, the registration requires a token from us, which is valid for one hour. So a bit of timely coordination will be required.

kinke avatar Jan 20 '25 13:01 kinke

As an alternative, some projects go the route of running SystemZ tests under qemu (see e.g. bytecodealliance/wasmtime@main/.github/workflows/main.yml)

You can run it under QEMU much simpler by using Docker: https://github.com/jacob-carlborg/lime/blob/1c457159eb3e435c85bfad9ab2aae8b1c6f55e94/.github/workflows/ci.yml#L217-L233.

jacob-carlborg avatar Apr 01 '25 06:04 jacob-carlborg