golang/go · critical
internal error in windynrelocsym: underlying sym for %q has
Error message
internal error in windynrelocsym: underlying sym for %q has wrong type %s
What it means
An internal consistency error in windynrelocsym. After resolving a __imp_ symbol's GOT redirect token, the code calls loadpe.LookupBaseFromImport to find the underlying symbol (originally SDYNIMPORT, later retyped to SWINDOWS). If the resolved symbol's type is not sym.SWINDOWS, the internal type invariant is violated.
Source
Thrown at src/cmd/link/internal/ld/data.go:869
}
tgot := ctxt.loader.SymGot(targ)
if tgot == loadpe.RedirectToDynImportGotToken {
// Consistency check: name should be __imp_X
sname := ctxt.loader.SymName(targ)
if !strings.HasPrefix(sname, "__imp_") {
return fmt.Errorf("internal error in windynrelocsym: redirect GOT token applied to non-import symbol %s", sname)
}
// Locate underlying symbol (which originally had type
// SDYNIMPORT but has since been retyped to SWINDOWS).
ds, err := loadpe.LookupBaseFromImport(targ, ctxt.loader, ctxt.Arch)
if err != nil {
return err
}
dstyp := ctxt.loader.SymType(ds)
if dstyp != sym.SWINDOWS {
return fmt.Errorf("internal error in windynrelocsym: underlying sym for %q has wrong type %s", sname, dstyp.String())
}
// Redirect relocation to the dynimport.
r.SetSym(ds)
continue
}
tplt := ctxt.loader.SymPlt(targ)
if tplt == loadpe.CreateImportStubPltToken {
// Consistency check: don't want to see both PLT and GOT tokens.
if tgot != -1 {
return fmt.Errorf("internal error in windynrelocsym: invalid GOT setting %d for reloc to %s", tgot, ctxt.loader.SymName(targ))
}
// make dynimport JMP table for PE object files.
tplt := int32(rel.Size())
ctxt.loader.SetPlt(targ, tplt)View on GitHub (pinned to b6b368adc5)
Solutions
- Report as a Go linker internal bug with full build configuration
- Clean rebuild: go clean -cache && go build
- Try -linkmode=external as a workaround
- Downgrade or upgrade Go to identify the version that introduced the regression
- Reduce the test case to the minimal CGO import that triggers the error
Defensive patterns
Strategy: fallback
Try / catch
// Wrap internal errors for actionable diagnostics
if err := processReloc(ctxt, s, ri); err != nil {
if strings.Contains(err.Error(), "internal error") {
log.Printf("Internal linker error detected. Try: go build -ldflags=-linkmode=external")
}
return err
} Prevention
- Internal linker errors are toolchain bugs — report them
- External linking can bypass internal linker relocation bugs
- Maintain reproducible builds to help diagnose when the issue started
When it happens
Trigger: loadpe.LookupBaseFromImport succeeds and returns a symbol handle ds. ctxt.loader.SymType(ds) is then compared against sym.SWINDOWS. If the type differs (e.g. still SDYNIMPORT, or some other type), the error includes the symbol name and actual type string.
Common situations: A bug in the PE symbol retyping logic that should have converted SDYNIMPORT to SWINDOWS; object files with unexpected symbol type metadata; a regression in the import resolution pipeline after a Go version upgrade.
Related errors
- internal error in windynrelocsym: redirect GOT token applied
- internal error in windynrelocsym: invalid GOT setting %d for
- internal error in windynrelocsym: unsupported arch %v
- dynamic relocation to unreachable symbol %s
- cannot find .data
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/66719faec6f73554.
Report an issue: GitHub.