#5702·tinygo

interp: an unrealated change to a map now causes interp to not finish initializing it

Author: soypatCreated Sep 18, 2026Updated Sep 18, 2026

This PR does changes related to dns package completely unrelated to a map in the ethernet package and now the map in the ethernet package cannot be initialized by interp causing it to remain in runtime code and cause binary increase.

https://github.com/soypat/lneto/pull/202

bash
# command used to build
tinygo build -o=mwe-pico-new3-small.elf -target=pico -tags=noslog -panic=trap  -size=short ./examples/min-working-example

AI:

How it happens

main-mwe.go now imports github.com/soypat/lneto/dns (for dns.MustNewName). dns imports net/netip, so net/netip.init now runs before ethernet.init. Before, it ran after.

TinyGo tries to run each package's init at compile time. It can't for netip.init (it stops inside unique.Make), so that init runs on the device. netip.init builds a map, which advances the runtime's random-number state used to seed map hashing (runtime.xorshift32State). From then on, TinyGo no longer knows that state at compile time.

When ethernet.init reaches the _Type_map literal, its hash seed comes from that unknown state, so all 41 inserts get deferred to startup. That keeps the whole map in the binary:

$alloc (48 B): the map header $alloc.190 (768 B): the buckets $alloca.*: the key/value temporaries $string.40 (352 B): _Type_name At 3af6b30, ethernet.init ran before netip.init, so the map was built at compile time and removed as unused.

How I confirmed it

mwe-pico-new-small.elf is a main build: the reflog shows your checkout was on main at 14:35 on Sep 16. new2 and new3 are both dns-cname builds and are the same size. Rebuilding each commit with your exact flags (-tags=noslog -panic=trap): 3af6b30 has no ethernet$ data and 097de68 does. -tags=onlytcp doesn't change this, and neither did the Type.String removal in 6c1c426. TinyGo's trace of the package inits (from -internal-dumpssa) shows the new order and fastrand returning an unknown value inside ethernet.init.