Skip to content

feat(terminal): harden Android arm64 bionic loader, packaging validation and docs - #2579

Merged
houko merged 1 commit into
mainfrom
feat/android-terminal-1452
Nov 27, 2026
Merged

houko merged 1 commit into
mainfrom
feat/android-terminal-1452

Conversation

@houko

@houko houko commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up hardening, bug fixes, ELF/packaging regression tests and documentation updates on top of #2139 for Android arm64 base/terminal support.

  • Bionic fakecgo __errno fix: internal/purego/internal/fakecgo/zsymbols_android_android_arm64.go previously imported glibc's __errno_location from libc.so, which bionic does not export (flagged in feat(terminal): support Android arm64 remote sessions #2139 review and fixed in upstream ebitengine/purego#572). Switched the dynamic import to bionic's __errno so Android's linker64 resolves it cleanly even when syscall.Setuid-family calls retain fakecgo.errno().
  • Thread-safe bionic dlerror & dlopen(NULL) semantics: internal/purego/dlfcn_android_nocgo_android_arm64.go now locks the OS thread across dlopen/dlsym/dlclose + dlerror, passes NULL for an empty dlopen path, and explicitly records //go:cgo_import_dynamic _ _ "libdl.so".
  • Android ELF validation & diagnostics:
    • Extended validateNativeBinary in cmd/nsgo/package_natives.go to validate android ELF64 shared libraries (ET_DYN, no PT_INTERP, matching architecture).
    • Updated androidGhosttyFile in cmd/nsgo/android.go to validate lib/android-arm64/libghostty-vt.so and report an error if the committed arm64 prebuild is missing or wrong-arch.
    • Clarified base/terminal/internal/library.Find() on android/arm64 when libghostty-vt.so is absent beside the executable.
  • Layering & review cleanup: Declared internal/purego/ and base/terminal/internal/vt in internal/moduletest/layering_test.go's layers table (removing the ad-hoc checkLayer exception) and unwrapped hard-wrapped comments.
  • Regression tests:
    • base/terminal/internal/library: tests for Android nativeLibraryDir sibling lookup and lib/android-arm64/libghostty-vt.so ELF verification (EM_AARCH64, ET_DYN, bionic-only DT_NEEDED, exported ghostty_* symbols).
    • cmd/nsgo: TestAndroidTerminalPackagingAndBionicELF builds real cgo-free android_arm64 APK, AAB and AAR packages with/without base/terminal, verifies libghostty-vt.so inclusion/omission across all three archive layouts, and inspects lib/arm64-v8a/libnsgo.so ELF headers (PT_INTERP == /system/bin/linker64, DT_NEEDED libdl.so + libc.so with no versioned glibc sonames, imported dlopen/dlsym/dlerror/__errno and no __errno_location).
    • tools/libghostty: added android-arm64 selection assertions.
  • Documentation: Updated docs/architecture/{terminal,layers,tool,embedding}.md, docs/roadmap.md, docs/public/{en,zh}/{terminal,embedding}.md, skills/nsgo/SKILL.md, and internal/purego/README.md to reflect shipped Android arm64 support, Android 10 (API 29+) requirement, and android/amd64 status.

Refs #1452

Verification

  • gofmt -l on all modified .go files: clean (empty)
  • go tool nsgo check -target android_arm64,macos_arm64,linux_x64 -jobs 3 & host go tool nsgo check: passed
  • go tool nsgo test ./tools/libghostty ./base/terminal/... ./internal/moduletest: passed (114 passed, 0 failed)
  • go tool nsgo test -run "TestTerminal|TestAndroid|TestNative|TestGhostty" ./cmd/nsgo: passed (32 passed, 0 failed)
  • NSGO_PLATFORM_DUPLICATES_BASE=origin/main go tool nsgo test -run '^TestPlatformFunctionDuplicates$' ./internal/moduletest: passed
  • go tool nsgo test -run '^TestRepositoryFragments$' ./tools/changelog: passed
  • Confirmed no changes to internal/platform/android/runtime/classes.dex or classes.jar.

🤖 Gemini 4 Neon

@github-actions github-actions Bot added enhancement New feature or request size/M documentation Improvements or additions to documentation base cli labels Nov 27, 2026
@houko
houko force-pushed the feat/android-terminal-1452 branch 2 times, most recently from 0eb5f46 to 63bd5e7 Compare November 27, 2026 10:40
@houko
houko force-pushed the feat/android-terminal-1452 branch from 63bd5e7 to 2c39475 Compare November 27, 2026 11:36
@houko
houko merged commit e3f058c into main Nov 27, 2026
45 checks passed
@houko
houko deleted the feat/android-terminal-1452 branch November 27, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

base cli documentation Improvements or additions to documentation enhancement New feature or request size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant