patchdata

command
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: MIT, BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Command patchdata writes the start address of .data, and the ranges of the globals that hold no heap pointers, into a TinyGo core built with the runtime fork in budget/tinygo.

patchdata <module.wasm> <linker.map>

The fork's findGlobals scans the globals from the address stored after the 8-byte marker "PiGDDATA" (runtime pigDataStart) instead of from __global_base, so the GC does not take .rodata words for heap pointers. wasm-ld defines no symbol for the start of .data, so build-wasm.sh links with --Map and this command takes the address of the .data output section from the map. It fails when the map has no .data section, when a memory section other than .rodata starts below .data, when the module holds the marker other than exactly once, or when the word is already set: a build cannot fall back to scanning .rodata, or skip a writable section, without failing.

The words after the address are [start, end) pairs the scan leaves out: the .data and .bss symbols in pointerFreeGlobals, merged where adjacent. It fails when they need more pairs than the runtime holds, or when the pairs are not unset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL