{"record":{"id":"7d6288a1c1f1cdf0","repo":"golang/go","slug":"loadxcoff-v-v","errorCode":null,"errorMessage":"loadxcoff: %v: %v","messagePattern":"loadxcoff: (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/link/internal/loadxcoff/ldxcoff.go","lineNumber":46,"sourceCode":"type xcoffBiobuf bio.Reader\n\nfunc (f *xcoffBiobuf) ReadAt(p []byte, off int64) (int, error) {\n\tret := ((*bio.Reader)(f)).MustSeek(off, 0)\n\tif ret < 0 {\n\t\treturn 0, errors.New(\"fail to seek\")\n\t}\n\tn, err := f.Read(p)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn n, nil\n}\n\n// loads the Xcoff file pn from f.\n// Symbols are written into loader, and a slice of the text symbols is returned.\nfunc Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, input *bio.Reader, pkg string, length int64, pn string) (textp []loader.Sym, err error) {\n\terrorf := func(str string, args ...any) ([]loader.Sym, error) {\n\t\treturn nil, fmt.Errorf(\"loadxcoff: %v: %v\", pn, fmt.Sprintf(str, args...))\n\t}\n\n\tvar ldSections []*ldSection\n\n\tf, err := xcoff.NewFile((*xcoffBiobuf)(input))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tfor _, sect := range f.Sections {\n\t\t//only text, data and bss section\n\t\tif sect.Type < xcoff.STYP_TEXT || sect.Type > xcoff.STYP_BSS {\n\t\t\tcontinue\n\t\t}\n\t\tlds := new(ldSection)\n\t\tlds.Section = *sect\n\t\tname := fmt.Sprintf(\"%s(%s)\", pkg, lds.Name)","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/loadxcoff/ldxcoff.go#L28-L64","documentation":"The Go linker's XCOFF object loader (used on AIX) encountered an error while loading an XCOFF format object file. This is a generic wrapper error from the `errorf` closure in the `Load` function; it prefixes the path of the file being loaded with the specific error message. XCOFF is IBM's object file format used on AIX, and this loader handles host object files (typically C code compiled via cgo) during linking on AIX.","triggerScenarios":"Fires from the `errorf` closure at ldxcoff.go:45-47, which is called at various points within the `Load` function when parsing errors occur (e.g., unrecognized section type at line 70, symbol processing failures). The function is invoked by the Go linker when processing .o files on GOOS=aix. The `xcoff.NewFile` call at line 51 can also fail separately (returning its own error without the wrapper).","commonSituations":"Compiling Go with cgo on AIX (`GOOS=aix`) where the C compiler (xlc or gcc) produces object files the Go linker cannot parse. Using an incompatible or outdated version of xlC/gcc on AIX. Mixing object files from different AIX toolchains. Corrupt object files from interrupted builds. AIX-specific ABI changes in newer compiler versions not yet handled by Go's XCOFF loader.","solutions":["Read the specific error message after the file path to understand what sub-operation failed (section type, symbol, relocation, etc.).","Ensure you are using a compatible C compiler on AIX — check the Go release notes for the minimum required xlC/gcc version.","Clean and rebuild: `go clean -cache && go build` to eliminate stale or corrupt object files.","If possible, switch from xlC to gcc or vice versa on AIX to see if the alternate compiler produces compatible output.","Update Go to the latest version — XCOFF loader support is actively maintained for AIX."],"exampleFix":"# Clean and rebuild on AIX\ngo clean -cache\nGOOS=aix go build ./...\n\n# Verify C compiler compatibility\nxlC --version  # or: gcc --version","handlingStrategy":"try-catch","validationCode":"// The Load function is linker-internal; validate XCOFF files externally:\n// Use AIX 'dump' command: dump -o file.o\n// Or use 'file' command to verify XCOFF format: file file.o","typeGuard":null,"tryCatchPattern":"// In Go linker integration code (if wrapping the linker):\n//   textp, err := loadxcoff.Load(l, arch, ver, input, pkg, length, pn)\n//   if err != nil {\n//       // err contains \"loadxcoff: <path>: <detail>\"\n//       log.Printf(\"XCOFF load failed for %s: %v\", pn, err)\n//       return fmt.Errorf(\"cannot link AIX object %s: %w\", pn, err)\n//   }","preventionTips":["Keep the xlC or gcc version on AIX consistent with what Go supports for your Go version.","Run go clean -cache after compiler updates on AIX.","Validate XCOFF object files with the 'dump' command before linking."],"tags":["linker","xcoff","aix","cgo","object-file","ibm"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}