• Kirill Smelkov's avatar
    tracing/runtime: Add support for Go1.23 and Go1.24 (StopTheWorld) · 1f596316
    Kirill Smelkov authored
    We already added some preliminary support for Go1.23 and Go1.24 in the
    following patches before:
    
    - 48920809 (tracing/runtime: Add support for Go1.23 (preliminary, incomplete))
    - 38c589c2 (tracing/runtime: Update support for Go1.23 (still incomplete))
    - 443006d5 (tracing/runtime: Add support for Go1.24 (incomplete))
    
    Those patches were incomplete because with go1.23 access to
    runtime.stopTheWorld becomes infeasible and the build breaks like this:
    
        go123/tracing$ go1.23 test
        # lab.nexedi.com/kirr/go123/tracing.test
        link: lab.nexedi.com/kirr/go123/tracing/internal/xruntime: invalid reference to runtime.stopTheWorld
        FAIL    lab.nexedi.com/kirr/go123/tracing [build failed]
    
    The problem here is that, as explained in https://github.com/golang/go/issues/68167,
    go:linkname access to runtime.stopTheWorld is no longer available and
    the Go team explicitly rejected our proposal restoring the access.
    
    Actually no-way to access to runtime.StopTheWorld was pre-determined
    to be ok from the beginning as https://github.com/golang/go/issues/43930#issuecomment-1852700705 shows:
    
        * MichaelK: fine to break programs that linkname to stoptheworld
    
    Ok, we find our other way and utilize runtime/debug.WriteHeapDump to
    stop/start the world, and hook into runtime to run our code from inside.
    
    With this patch tracing/runtime and tracing become functional on go1.23 and go1.24 .
    
    For the reference: regenerated files stay without changes for Go1.24, Go1.24 and previous releases.
    1f596316
Analyzing file…
go.mod 416 Bytes