Skip to content

Commit 33e3627

Browse files
myleshortonclaude
andcommitted
android: strip Go binary via -s -w in gomobile bind
The Android gomobile target was the only ldflags site in the Makefile not passing -s -w. Every other Go build (line 195, 219, 321, 329) does. Confirmed via go-size-analyzer that libgojni.so retains gopclntab / moduledata in the current build despite the NDK linker stripping the ELF symbol table. Adding -s -w to ANDROID_GOMOBILE_LDFLAGS should recover ~10-30 MB on the 82 MB libgojni.so for arm64. This is on top of the arm32 drop + ML Kit unbundle + jniLibs excludes in the prior commits on this branch — combined we expect APK size to land somewhere in the ~40-45 MB range from the 93 MB baseline. Follow-ups still on the table (separate PRs): 1. with_tailscale sing-box tag: pulls in sagernet/tailscale (10K string occurrences in the binary, single largest contributor). Client never invokes the tailscale outbound — Headscale plumbing is server-side bandit fleet only. 2. lantern-water/downloader's magnet:? URL branch pulls in anacrolix/torrent + btree + dht. Split behind a build tag in lantern-water (off by default); we only use HTTPS retrieval. 3. with_clash_api / with_acme / with_dhcp: review each — likely server-side or unused on the client. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 26765ac commit 33e3627

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ ANDROID_SDK_ROOT := $(or $(ANDROID_SDK_ROOT),$(ANDROID_HOME))
120120
SDKMANAGER := $(ANDROID_SDK_ROOT)/cmdline-tools/latest/bin/sdkmanager
121121
ANDROID_PAGE_SIZE ?= 16384
122122
# Android 15+ Play requirement: arm64 native libs must be linked for 16 KB page-size compatibility.
123-
ANDROID_GOMOBILE_LDFLAGS ?= -checklinkname=0 -extldflags=-Wl,-z,max-page-size=$(ANDROID_PAGE_SIZE),-z,common-page-size=$(ANDROID_PAGE_SIZE)
123+
ANDROID_GOMOBILE_LDFLAGS ?= -s -w -checklinkname=0 -extldflags=-Wl,-z,max-page-size=$(ANDROID_PAGE_SIZE),-z,common-page-size=$(ANDROID_PAGE_SIZE)
124124

125125
IOS_INSTALLER := $(INSTALLER_NAME)$(if $(filter-out production,$(BUILD_TYPE)),-$(BUILD_TYPE)).ipa
126126
IOS_DIR := ios/

0 commit comments

Comments
 (0)