Skip to content

purego: add support for ppc64le#408

Open
gdams wants to merge 8 commits intoebitengine:mainfrom
gdams:ppc64le
Open

purego: add support for ppc64le#408
gdams wants to merge 8 commits intoebitengine:mainfrom
gdams:ppc64le

Conversation

@gdams
Copy link
Contributor

@gdams gdams commented Feb 2, 2026

What issue is this addressing?

closes #407

What type of issue is this addressing?

feature

What this PR does | solves

This PR adds the neccessary code logic to support PPC64LE with both CGO enabled/disabled

@gdams gdams marked this pull request as draft February 2, 2026 16:02
@gdams gdams force-pushed the ppc64le branch 4 times, most recently from 58ff8c4 to 5c0b584 Compare February 2, 2026 20:09
@gdams gdams marked this pull request as ready for review February 3, 2026 09:07
@gdams
Copy link
Contributor Author

gdams commented Feb 4, 2026

@hajimehoshi updated PTAL

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive support for the PPC64LE (64-bit PowerPC Little-Endian) architecture to the purego library, enabling it to work on Linux PPC64LE systems with both CGO enabled and disabled.

Changes:

  • Added PPC64LE-specific assembly implementations for syscalls and callbacks following the ELFv2 ABI
  • Implemented PPC64LE struct marshaling with homogeneous float aggregate support
  • Added fakecgo trampolines and ABI transition macros for PPC64LE
  • Updated all build tags, tests, documentation, and CI/CD to include PPC64LE support

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
zcallback_ppc64le.s Generated callback trampoline table (2000 entries)
wincallback.go Added generator function for PPC64LE callback trampolines
syscall_sysv_ppc64le.go PPC64LE-specific callbackArgs with separate stack pointer
syscall_sysv_others.go Refactored common callbackArgs for other architectures
syscall_sysv.go Added PPC64LE stack args handling and updated build tags
syscall_cgo_linux.go Updated CGO fallback build tag to include PPC64LE
sys_unix_ppc64le.s Callback assembly following ELFv2 ABI with 200-byte frame
sys_ppc64le.s Syscall15X implementation with proper register/stack marshaling
struct_ppc64le.go Struct handling with HFA detection and 16-byte threshold
internal/fakecgo/trampolines_ppc64le.s CGO-to-Go trampolines for runtime integration
internal/fakecgo/asm_ppc64le.s crosscall2 implementation saving GPR/FPR registers
internal/fakecgo/abi_ppc64x.h ABI transition macros for register save/restore
abi_ppc64x.h Duplicate of fakecgo header for main package
internal/cgo/syscall_cgo_unix.go Updated build tag exclusion list
func_test.go Added PPC64LE to test skips for float32 stack args
callback_test.go Updated build tag to include PPC64LE
func.go Added PPC64LE float32 return handling and register counts
README.md Added PPC64LE to Tier 2 platform list
.github/workflows/test.yml Added PPC64LE cross-compilation and QEMU testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@hajimehoshi hajimehoshi left a comment

Choose a reason for hiding this comment

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

LGTM

@TotallyGamerJet PTAL

Copy link
Collaborator

@TotallyGamerJet TotallyGamerJet left a comment

Choose a reason for hiding this comment

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

LGTM

// Below are out-args from callbackWrap
result uintptr
}
// callbackArgs is implemented in syscall_sysv_others.go and syscall_sysv_ppc64le.go
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this comment since its clear from where the type definition is

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 PPC64LE

3 participants