{"record":{"id":"44b43f76846de19c","repo":"golang/go","slug":"internal-error-in-windynrelocsym-invalid-got-sett","errorCode":null,"errorMessage":"internal error in windynrelocsym: invalid GOT setting %d for reloc to %s","messagePattern":"internal error in windynrelocsym: invalid GOT setting (.+?) for reloc to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/cmd/link/internal/ld/data.go","lineNumber":882,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdstyp := ctxt.loader.SymType(ds)\n\t\t\tif dstyp != sym.SWINDOWS {\n\t\t\t\treturn fmt.Errorf(\"internal error in windynrelocsym: underlying sym for %q has wrong type %s\", sname, dstyp.String())\n\t\t\t}\n\n\t\t\t// Redirect relocation to the dynimport.\n\t\t\tr.SetSym(ds)\n\t\t\tcontinue\n\t\t}\n\n\t\ttplt := ctxt.loader.SymPlt(targ)\n\t\tif tplt == loadpe.CreateImportStubPltToken {\n\n\t\t\t// Consistency check: don't want to see both PLT and GOT tokens.\n\t\t\tif tgot != -1 {\n\t\t\t\treturn fmt.Errorf(\"internal error in windynrelocsym: invalid GOT setting %d for reloc to %s\", tgot, ctxt.loader.SymName(targ))\n\t\t\t}\n\n\t\t\t// make dynimport JMP table for PE object files.\n\t\t\ttplt := int32(rel.Size())\n\t\t\tctxt.loader.SetPlt(targ, tplt)\n\n\t\t\tif su == nil {\n\t\t\t\tsu = ctxt.loader.MakeSymbolUpdater(s)\n\t\t\t}\n\t\t\tr.SetSym(rel.Sym())\n\t\t\tr.SetAdd(int64(tplt))\n\n\t\t\t// jmp *addr\n\t\t\tswitch ctxt.Arch.Family {\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"internal error in windynrelocsym: unsupported arch %v\", ctxt.Arch.Family)\n\t\t\tcase sys.I386:\n\t\t\t\trel.AddUint8(0xff)","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/ld/data.go#L864-L900","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Report as a Go linker internal bug at https://github.com/golang/go/issues","Clean rebuild: go clean -cache && go build","Try -linkmode=external as a workaround","Identify the Go version that introduced the issue by testing with older releases","Simplify CGO dependencies to find the triggering import pattern"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Suggest external linker for internal PE relocation errors\nif err := windynrelocsym(ctxt, s, r, ri); err != nil {\n    if strings.Contains(err.Error(), \"internal error\") {\n        return fmt.Errorf(\"%w (workaround: -linkmode=external)\", err)\n    }\n    return err\n}","preventionTips":["No user-side prevention for internal linker consistency errors","Use -linkmode=external as an immediate workaround","Report the full build configuration to the Go project for investigation","Reduce CGO dependencies to isolate the triggering import pattern"],"tags":["relocation","windows","pe","linker","go-toolchain","internal-error"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}