{"record":{"id":"b790163abf5c214e","repo":"golang/go","slug":"cannot-find-go-fipsinfo","errorCode":null,"errorMessage":"cannot find __go_fipsinfo","messagePattern":"cannot find __go_fipsinfo","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/link/internal/ld/fips140.go","lineNumber":351,"sourceCode":"\t}\n\tdefer mf.Close()\n\n\twf, err := os.OpenFile(exe, os.O_RDWR, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer wf.Close()\n\n\tf, err := newFipsObj(wf, fipso)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\t// Find the go:fipsinfo symbol.\n\tsect := mf.Section(\"__go_fipsinfo\")\n\tif sect == nil {\n\t\treturn fmt.Errorf(\"cannot find __go_fipsinfo\")\n\t}\n\tdata, err := sect.Data()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuptr := ctxt.Arch.ByteOrder.Uint64\n\tif ctxt.Arch.PtrSize == 4 {\n\t\tuptr = func(x []byte) uint64 {\n\t\t\treturn uint64(ctxt.Arch.ByteOrder.Uint32(x))\n\t\t}\n\t}\n\n\t// Add the sections listed in go:fipsinfo to the FIPS object.\n\t// On Mac, the debug/macho package is not reporting any relocations,\n\t// but the addends are all in the data already, all relative to\n\t// the same base.\n\t// Determine the base used for the self pointer, and then apply","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/ld/fips140.go#L333-L369","documentation":"During Mach-O (macOS/iOS) FIPS 140 post-link processing, the linker opens the linked executable and looks for the __go_fipsinfo section using macho.File.Section(\"__go_fipsinfo\"). If this section is absent, the FIPS info symbol was not emitted during compilation or was stripped, and the post-link step cannot proceed.","triggerScenarios":"The machofips function calls mf.Section(\"__go_fipsinfo\") on the opened Mach-O binary. If the return is nil (section not found), the error is returned. This section should have been created by the Go compiler when FIPS support is enabled.","commonSituations":"FIPS post-linking is invoked but the compilation did not actually emit FIPS info (e.g. GOFIPS not set at compile time); the section was stripped by an external tool or -ldflags='-s'; mixing FIPS-enabled and non-FIPS object files; Go version mismatch where the compiler does not emit the section.","solutions":["Ensure FIPS is enabled at compile time (GOFIPS=1 or appropriate build tags)","Do not strip debug/symbol info with -s or -w when FIPS is required","Verify all packages are compiled with the same FIPS-enabled Go toolchain","Clean rebuild: go clean -cache && GOFIPS=1 go build","Check Go version supports FIPS for macOS (1.24+)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before FIPS post-link, verify the section exists\nfunc verifyMachOFipsInfo(exe string) error {\n    mf, err := macho.Open(exe)\n    if err != nil {\n        return err\n    }\n    defer mf.Close()\n    if mf.Section(\"__go_fipsinfo\") == nil {\n        return fmt.Errorf(\"binary lacks __go_fipsinfo — was FIPS enabled at compile time?\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Handle missing FIPS section gracefully\nsect := mf.Section(\"__go_fipsinfo\")\nif sect == nil {\n    return fmt.Errorf(\"cannot find __go_fipsinfo (ensure GOFIPS=1 at build time, avoid -s/-w stripping)\")\n}","preventionTips":["Enable FIPS at compile time: GOFIPS=1 go build","Never strip the binary (-s, -w) when FIPS verification is required","Ensure all packages are compiled with the same FIPS-enabled toolchain","Verify Go version supports FIPS for macOS (1.24+)"],"tags":["fips","fips140","mach-o","linker","go-toolchain","darwin"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}