github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/gc_globals.go (about)

     1  //go:build (gc.conservative || gc.precise) && (baremetal || tinygo.wasm)
     2  
     3  package runtime
     4  
     5  // This file implements findGlobals for all systems where the start and end of
     6  // the globals section can be found through linker-defined symbols.
     7  
     8  // findGlobals finds all globals (which are reachable by definition) and calls
     9  // the callback for them.
    10  //
    11  // This implementation marks all globals conservatively and assumes it can use
    12  // linker-defined symbols for the start and end of the .data section.
    13  func findGlobals(found func(start, end uintptr)) {
    14  	found(globalsStart, globalsEnd)
    15  }