Skip to content

fix: link linux/arm64 Go builds without gold - #372

Open
imposecost wants to merge 1 commit into
Adaptix-Framework:testing-v2.0from
imposecost:fix/linux-arm64-gold-linker
Open

imposecost wants to merge 1 commit into
Adaptix-Framework:testing-v2.0from
imposecost:fix/linux-arm64-gold-linker

Conversation

@imposecost

Copy link
Copy Markdown

Fixes #371

Summary

  • On linux/arm64, Go's external linker injects -fuse-ld=gold. Gold is deprecated and often missing; gcc then dies with collect2: fatal error: cannot find ‘ld’ while linking AdaptixServer (cgo/sqlite3) and -buildmode=plugin extenders.
  • Shared go_ldflags.mk appends -extldflags=-fuse-ld=bfd when ld.gold is not on PATH. Used by the root Makefile, extender Makefiles, and axtool's own Makefile.
  • axtool server build uses the same extra ldflags. The build runner also sets CGO_LDFLAGS=-fuse-ld=bfd so plugin make invocations pick it up.
  • Scaffolded plugin Makefiles (axtool init) get the same gold fallback.
  • Harmless on Go 1.26.3+, which no longer requires gold when GNU ld is 2.36+.

Related: #370 (wrong-arch Go tarball on aarch64). This is the next failure after a working arm64 go is installed.

CGO_ENABLED=0 is not a workaround: AdaptixServer uses mattn/go-sqlite3, and plugins require cgo.

Test plan

  • linux/amd64: make server still links as before (GO_LDFLAGS is -s -w)
  • linux/arm64 with ld.gold: unchanged; gold still used
  • linux/arm64 without ld.gold, Go < 1.26.3: make server and make extenders succeed; gcc command line has -fuse-ld=bfd after -fuse-ld=gold
  • ./dist/axtool adaptix.spec server build on linux/arm64 without gold succeeds
  • go test ./internal/build/ in AdaptixTools

Go's linux/arm64 external linker injects -fuse-ld=gold. When gold is
missing, gcc fails with "cannot find 'ld'" while linking AdaptixServer
(cgo/sqlite3) and plugin extenders.

Pass -extldflags=-fuse-ld=bfd when gold is not on PATH, and set the
same via CGO_LDFLAGS in axtool's build runner.
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.

1 participant