Skip to content

plan9asm: map runtime.memmove to libc#2127

Merged
xushiwei merged 2 commits into
xgo-dev:mainfrom
zhouguangyuan0718:codex/memmove-asm-symbol
Jul 20, 2026
Merged

plan9asm: map runtime.memmove to libc#2127
xushiwei merged 2 commits into
xgo-dev:mainfrom
zhouguangyuan0718:codex/memmove-asm-symbol

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Add an unconditional manual signature for the external runtime.memmove assembly symbol.
  • Set its emitted FuncSig.Name to memmove, so LLGo links the call to libc memmove without package- or architecture-specific checks.
  • Update the github.com/xgo-dev/plan9asm dependency from v0.3.0 to v0.3.2, which includes the required external-symbol and ARM64 assembly support.
  • Add a unit assertion covering the generic manual signature.

Why

github.com/klauspost/compress/s2 uses CALL runtime·memmove(SB) in its amd64 and arm64 assembly. LLGo does not provide the Go runtime symbol runtime.memmove; the corresponding implementation is libc memmove. The previous resolution path could not express this external declaration name without special-casing the resolver.

The newer plan9asm release also carries the assembly support needed by optimized compression dependencies, including the ARM64 instructions used by s2, reedsolomon, and crc64nvme.

Scope

The LLGo change is intentionally limited to extraAsmSigsAndDeclMap: symbol normalization remains generic, and no package path or architecture is used to select the memmove mapping. The dependency update uses the published plan9asm v0.3.2 release, which contains the merged changes from xgo-dev/plan9asm#17.

Validation

  • go test ./internal/plan9asm.
  • Built the llgo CLI with plan9asm v0.3.2.
  • Forced full LLGo builds of github.com/klauspost/compress/s2, github.com/klauspost/reedsolomon, and github.com/minio/crc64nvme using the updated dependency.

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/memmove-asm-symbol branch 2 times, most recently from 9a193fb to 2d6667c Compare July 19, 2026 11:19
@zhouguangyuan0718
zhouguangyuan0718 marked this pull request as ready for review July 19, 2026 11:25
@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the codex/memmove-asm-symbol branch from 2d6667c to ab1e8cf Compare July 19, 2026 15:41
@xushiwei
xushiwei merged commit e5af87b into xgo-dev:main Jul 20, 2026
42 checks passed
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.

2 participants