Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

64-bit big endian PowerPC ABIv2 support #12667

Merged
merged 4 commits into from
Oct 16, 2023

Conversation

awilfox
Copy link
Contributor

@awilfox awilfox commented Oct 16, 2023

Passes on: Linux gwyn.foxkit.us 5.15.98-mc4-easy #1 SMP Sun Apr 2 00:16:18 CDT 2023 ppc64 GNU/Linux

Summary:
  3457 tests passed
   74 tests skipped
    0 tests failed
  137 tests not started (parent test skipped or failed)
    0 unexpected errors
  3668 tests considered

Fixes: #12656

This updates the asmgen code the same way the runtime assembler was
updated in 05d82f9.
This will only work on ABIv2 systems, such as Linux on musl libc and
FreeBSD/OpenBSD.  Tested on musl libc system and all tests pass.
Copy link
Contributor

@dustanddreams dustanddreams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified to not cause any regression building and running the compiler testsuite on powerpc64le.

Copy link
Contributor

@xavierleroy xavierleroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see that the ELFv2 ABI works equally well in big-endian than in little-endian. Thanks! This is good to go, but the configure script may need to be hardened later to check that the ABI is actually ELFv2.

@@ -1262,6 +1262,8 @@ AS_CASE([$host],
[arch=amd64; system=win64],
[[powerpc64le*-*-linux*]],
[has_native_backend=yes; arch=power; model=ppc64le; system=linux],
[[powerpc64*-*-linux-musl*]],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming that given the history of Musl on Power, this implies that the ELFv2 ABI is used.

I wish config.guess was more explicit about which version of the ABI is used. E.g. on Ubuntu 16.04 PPC (the last Ubuntu to support big-endian PPC, using the ELFv1 ABI), config.guess reports powerpc64-unknown-linux-gnu, which does not obviously imply that it's ELFv1 and not ELFv2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The v2 ABI requires the preprocessor symbol _CALL_ELF to be defined with a value of 2. Some autoconf machinery could check for this and only enable native code on v2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. For the time being, I just added a check on _CALL_ELF in runtime/power.S, to abort in case of ABI mismatch. We'll see later if this needs to be done in configure.

@xavierleroy xavierleroy merged commit 82a04cf into ocaml:trunk Oct 16, 2023
9 checks passed
@sideeffect42
Copy link

Thank you, @awilfox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support native compilation on big-endian ppc64
4 participants