{"record":{"id":"ecae2dfca959b5b5","repo":"golang/go","slug":"text-section-not-found-ecae2d","errorCode":null,"errorMessage":"text section not found","messagePattern":"text section not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/objfile/xcoff.go","lineNumber":103,"sourceCode":"\t}\n\n\treturn syms, nil\n}\n\nfunc (f *xcoffFile) pcln() (textStart uint64, pclntab []byte, err error) {\n\tif sect := f.xcoff.Section(\".text\"); sect != nil {\n\t\ttextStart = sect.VirtualAddress\n\t}\n\tif pclntab, err = loadXCOFFTable(f.xcoff, \"runtime.pclntab\", \"runtime.epclntab\"); err != nil {\n\t\treturn 0, nil, err\n\t}\n\treturn textStart, pclntab, nil\n}\n\nfunc (f *xcoffFile) text() (textStart uint64, text []byte, err error) {\n\tsect := f.xcoff.Section(\".text\")\n\tif sect == nil {\n\t\treturn 0, nil, fmt.Errorf(\"text section not found\")\n\t}\n\ttextStart = sect.VirtualAddress\n\ttext, err = sect.Data()\n\treturn\n}\n\nfunc findXCOFFSymbol(f *xcoff.File, name string) (*xcoff.Symbol, error) {\n\tfor _, s := range f.Symbols {\n\t\tif s.Name != name {\n\t\t\tcontinue\n\t\t}\n\t\tif s.SectionNumber <= 0 {\n\t\t\treturn nil, fmt.Errorf(\"symbol %s: invalid section number %d\", name, s.SectionNumber)\n\t\t}\n\t\tif len(f.Sections) < s.SectionNumber {\n\t\t\treturn nil, fmt.Errorf(\"symbol %s: section number %d is larger than max %d\", name, s.SectionNumber, len(f.Sections))\n\t\t}\n\t\treturn s, nil","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/objfile/xcoff.go#L85-L121","documentation":"xcoffFile.text() looks up the '.text' section to extract executable code and its starting virtual address. If Section(\".text\") returns nil, the file has no text segment and code extraction cannot proceed.","triggerScenarios":"Calling text() on an xcoffFile whose underlying xcoff.File has no '.text' section — e.g. a relocatable/object file before final linking, or a non-executable XCOFF.","commonSituations":"Pointing the tool at a .o relocatable object instead of the linked executable, or a corrupted AIX binary.","solutions":["Inspect the fully-linked XCOFF executable rather than an intermediate object.","Rebuild the AIX binary.","Verify the file with AIX 'dump -ov' or 'file'."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// textStart, text, err := xf.text()\n// if err != nil {\n//     if strings.Contains(err.Error(), \"text section not found\") {\n//         // not a linked XCOFF executable\n//     }\n//     return err\n// }","preventionTips":["Inspect fully-linked XCOFF executables, not relocatable .o files.","Confirm the file with 'file' / AIX 'dump'.","Rebuild the AIX binary if integrity is in doubt."],"tags":["xcoff","aix","binary","objfile","section"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}