golang/go · critical

internal error in windynrelocsym: invalid GOT setting %d for

Error message

internal error in windynrelocsym: invalid GOT setting %d for reloc to %s

What it means

An internal consistency error in windynrelocsym. When a symbol's PLT (Procedure Linkage Table) entry equals CreateImportStubPltToken, the code checks that the GOT entry is unset (tgot == -1). If both PLT and GOT tokens are present simultaneously, the symbol's relocation state is inconsistent — these tokens are mutually exclusive.

Source

Thrown at src/cmd/link/internal/ld/data.go:882

			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)

			if su == nil {
				su = ctxt.loader.MakeSymbolUpdater(s)
			}
			r.SetSym(rel.Sym())
			r.SetAdd(int64(tplt))

			// jmp *addr
			switch ctxt.Arch.Family {
			default:
				return fmt.Errorf("internal error in windynrelocsym: unsupported arch %v", ctxt.Arch.Family)
			case sys.I386:
				rel.AddUint8(0xff)

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Report as a Go linker internal bug at https://github.com/golang/go/issues
  2. Clean rebuild: go clean -cache && go build
  3. Try -linkmode=external as a workaround
  4. Identify the Go version that introduced the issue by testing with older releases
  5. Simplify CGO dependencies to find the triggering import pattern
Defensive patterns

Strategy: fallback

Try / catch

// Suggest external linker for internal PE relocation errors
if err := windynrelocsym(ctxt, s, r, ri); err != nil {
    if strings.Contains(err.Error(), "internal error") {
        return fmt.Errorf("%w (workaround: -linkmode=external)", err)
    }
    return err
}

Prevention

When it happens

Trigger: ctxt.loader.SymPlt(targ) returns CreateImportStubPltToken. The code then checks tgot != -1. If the GOT was also set (not -1), the error fires with the GOT value and symbol name, since the relocation cannot simultaneously use both PLT and GOT import mechanisms.

Common situations: A bug in the PE import setup that assigns both PLT and GOT tokens to the same symbol; corrupted or inconsistent loader state during concurrent linking; regression in import handling code after a Go toolchain update.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/44b43f76846de19c. Report an issue: GitHub.