Add nodefaultstack build tag to unlink gVisor from lneto-only binaries - #5
Open
xinix00 wants to merge 1 commit into
Open
Add nodefaultstack build tag to unlink gVisor from lneto-only binaries#5xinix00 wants to merge 1 commit into
xinix00 wants to merge 1 commit into
Conversation
Interface.Init falls back to NewGVisorStack when no Stack is set. That unconditional reference links the entire gVisor netstack (~617KB of symbols plus its pclntab share, ~1.8MB of a small tamago binary) into every binary using Interface, including binaries that explicitly construct an LnetoStack and never touch gVisor. Move the fallback behind newDefaultStack and exclude gvisor.go under a new 'nodefaultstack' build tag. The whole file has to go rather than the fallback alone: tagging only the function still linked ~104KB of package init graphs. Default behavior is unchanged. Building with -tags nodefaultstack removes the fallback, Init returns an error on a nil Stack, and the linker drops gVisor entirely: measured 8.65MB -> 6.83MB (-21%) on an otherwise identical tamago/arm64 binary, gVisor symbols 617KB -> 0.
xinix00
force-pushed
the
nodefaultstack
branch
from
August 11, 2026 05:12
faea062 to
ff52d56
Compare
Author
|
Trimmed the doc comments on both newDefaultStack halves and squashed; no functional change. Rebuilt and tested with and without the tag. |
Contributor
|
If
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Interface.Init falls back to NewGVisorStack when no Stack is set; that single reference links the whole gVisor netstack into every binary using Interface, including ones that explicitly construct an LnetoStack. On a tamago/arm64 binary that is ~617KB of symbols plus their pclntab share.
This moves the fallback behind newDefaultStack and excludes gvisor.go under a new
nodefaultstackbuild tag (excluding just the fallback still linked ~104KB of package-init graphs). Default builds are unchanged; with-tags nodefaultstackInit errors on a nil Stack and the linker drops gVisor entirely: 8.65MB → 6.83MB (−21%) on an otherwise identical binary.