{"record":{"id":"da3c50aa8e9045d7","repo":"golang/go","slug":"unsupported-architecture-for-seh-v","errorCode":null,"errorMessage":"unsupported architecture for SEH: %v","messagePattern":"unsupported architecture for SEH: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/link/internal/loadpe/seh.go","lineNumber":32,"sourceCode":")\n\nconst (\n\tUNW_FLAG_EHANDLER  = 1 << 3\n\tUNW_FLAG_UHANDLER  = 2 << 3\n\tUNW_FLAG_CHAININFO = 4 << 3\n\tunwStaticDataSize  = 4 // Bytes of unwind data before the variable length part.\n\tunwCodeSize        = 2 // Bytes per unwind code.\n)\n\n// processSEH walks host-object pdata relocations and returns the set of\n// per-entry pdata symbols created from the input section.\nfunc processSEH(ldr *loader.Loader, arch *sys.Arch, pdata sym.LoaderSym) ([]loader.Sym, error) {\n\tswitch arch.Family {\n\tcase sys.AMD64:\n\t\treturn processSEHAMD64(ldr, pdata)\n\tdefault:\n\t\t// TODO: support SEH on other architectures.\n\t\treturn nil, fmt.Errorf(\"unsupported architecture for SEH: %v\", arch.Family)\n\t}\n}\n\nfunc processSEHAMD64(ldr *loader.Loader, pdata sym.LoaderSym) ([]loader.Sym, error) {\n\t// The following loop traverses a list of pdata entries,\n\t// each entry being 3 relocations long. The first relocation\n\t// is a pointer to the function symbol to which the pdata entry\n\t// corresponds. The third relocation is a pointer to the\n\t// corresponding .xdata entry.\n\t// Reference:\n\t// https://learn.microsoft.com/en-us/cpp/build/exception-handling-x64#struct-runtime_function\n\trels := ldr.Relocs(pdata)\n\tif rels.Count()%3 != 0 {\n\t\treturn nil, fmt.Errorf(\".pdata symbol %q has invalid relocation count\", ldr.SymName(pdata))\n\t}\n\tdata := ldr.Data(pdata)\n\tentries := make([]loader.Sym, 0, rels.Count()/3)\n","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/loadpe/seh.go#L14-L50","documentation":"The Go linker's Structured Exception Handling (SEH) processor was invoked for an architecture other than AMD64. SEH is the Windows exception handling mechanism; the Go linker processes `.pdata` sections from host object files to preserve exception handling metadata. Currently only the AMD64 (x86-64) architecture is implemented; calling `processSEH` on any other architecture family (ARM64, I386, etc.) returns this error.","triggerScenarios":"Fires in `processSEH` at seh.go:26-33 when `arch.Family` does not match `sys.AMD64`. This function is called during PE object file loading when the linker encounters a `.pdata` section that needs SEH processing. The TODO comment confirms ARM64 and other Windows architectures are not yet supported.","commonSituations":"Cross-compiling Go with cgo for Windows ARM64 (`GOOS=windows GOARCH=arm64`) where the C object files contain .pdata sections. Linking ARM64 Windows object files that include SEH unwind data. Using an experimental or development version of Go on a new Windows architecture. Inadvertently triggering SEH processing on i386 Windows builds that include SEH-style object files.","solutions":["Check if your target architecture is actually AMD64 — if you are cross-compiling, verify GOARCH is set correctly (`echo $GOARCH`).","For Windows ARM64 cgo, use external linker mode (`-ldflags=-linkmode=external`) to delegate SEH processing to the system linker which handles all architectures.","Update Go — ARM64 SEH support may be added in future releases; check the Go issue tracker and release notes.","File a feature request / bug at https://go.dev/issue requesting SEH support for your target architecture.","If possible, compile the C code without SEH unwind tables (e.g., `/SAFESEH:NO` with MSVC) to avoid triggering SEH processing."],"exampleFix":"# Use external linker for non-AMD64 Windows targets\nGOOS=windows GOARCH=arm64 go build -ldflags='-linkmode=external' ./...\n\n# Or verify you are on the correct architecture\nGOOS=windows GOARCH=amd64 go build ./...","handlingStrategy":"validation","validationCode":"// Check target architecture before building with cgo on Windows\n// For ARM64 Windows, use external linker mode:\nif goarch == \"arm64\" && goos == \"windows\" {\n    ldflags = append(ldflags, \"-linkmode=external\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify GOARCH before building cgo projects for Windows — only amd64 is fully supported for internal SEH processing.","Use -ldflags=-linkmode=external when targeting Windows ARM64 with cgo.","Check Go release notes for architecture support updates in the PE loader.","Avoid .pdata-reliant C code on unsupported Windows architectures."],"tags":["linker","pe","seh","windows","architecture","arm64","exception-handling"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}