Skip to content

fix: add FreeBSD ARM64 support (v0.5.3)#53

Merged
kolkov merged 2 commits into
mainfrom
fix/freebsd-arm64
May 28, 2026
Merged

fix: add FreeBSD ARM64 support (v0.5.3)#53
kolkov merged 2 commits into
mainfrom
fix/freebsd-arm64

Conversation

@kolkov

@kolkov kolkov commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix FreeBSD ARM64 build failure by adding freebsd to build tags in 4 files (Fails to build under FreeBSD / arm #52)
  • Hidden bug: ffi/callback_arm64.s was missing freebsd while Go side already included it — NewCallback() would silently return invalid addresses on FreeBSD ARM64
  • CI cross-compilation check now validates all 8 platforms (was 7)

Details

FreeBSD ARM64 uses the identical AAPCS64 calling convention as Linux ARM64 — no code changes needed, purely build tag additions. Confirmed by ARM IHI 0055 specification and purego reference (identical approach in their FreeBSD ARM64 support commit).

Files changed (build tags):

File Before After
internal/arch/arm64/call_arm64.go linux || darwin || windows + freebsd
internal/syscall/syscall_arm64.go linux || darwin || windows + freebsd
internal/syscall/syscall_arm64.s linux || darwin || windows + freebsd
ffi/callback_arm64.s linux || darwin + freebsd

Verification: All 8 platforms cross-compile successfully:

linux/amd64:    ✅    windows/amd64:  ✅
linux/arm64:    ✅    windows/arm64:  ✅
darwin/amd64:   ✅    freebsd/amd64:  ✅
darwin/arm64:   ✅    freebsd/arm64:  ✅

Test plan

  • Cross-compilation GOOS=freebsd GOARCH=arm64 passes
  • All 8 platforms compile (regression check)
  • Windows tests pass locally
  • go vet clean (pre-existing dl_windows.go warnings unchanged)
  • CI green (Linux, macOS, Windows)

Closes #52

kolkov added 2 commits May 28, 2026 13:29
Add freebsd to build tags in 4 files that were missing it:
- internal/arch/arm64/call_arm64.go (root cause of #52)
- internal/syscall/syscall_arm64.go
- internal/syscall/syscall_arm64.s
- ffi/callback_arm64.s (hidden bug: Go side had freebsd, asm did not)

FreeBSD ARM64 uses identical AAPCS64 calling convention as Linux ARM64.
No code changes needed — purely build tag additions.

CI cross-compilation check now validates all 8 platforms.
Platform count: 7 → 8 targets.
Add explicit comments explaining that go vet warnings on lines 52 and 84
are false positives — Windows DLL handles and function pointers are OS
values, not Go heap pointers.
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kolkov kolkov merged commit 542dbd2 into main May 28, 2026
13 checks passed
@kolkov kolkov deleted the fix/freebsd-arm64 branch May 28, 2026 10:38
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.

Fails to build under FreeBSD / arm

1 participant