{"record":{"id":"8cc3afa90f2fa210","repo":"golang/go","slug":"s-and-s-symbols-must-be-in-the-same-section-8cc3af","errorCode":null,"errorMessage":"%s and %s symbols must be in the same section","messagePattern":"(.+?) and (.+?) symbols must be in the same section","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/objfile/xcoff.go","lineNumber":136,"sourceCode":"\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\n\t}\n\treturn nil, fmt.Errorf(\"no %s symbol found\", name)\n}\n\nfunc loadXCOFFTable(f *xcoff.File, sname, ename string) ([]byte, error) {\n\tssym, err := findXCOFFSymbol(f, sname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tesym, err := findXCOFFSymbol(f, ename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif ssym.SectionNumber != esym.SectionNumber {\n\t\treturn nil, fmt.Errorf(\"%s and %s symbols must be in the same section\", sname, ename)\n\t}\n\tsect := f.Sections[ssym.SectionNumber-1]\n\tdata, err := sect.Data()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn data[ssym.Value:esym.Value], nil\n}\n\nfunc (f *xcoffFile) goarch() string {\n\tswitch f.xcoff.TargetMachine {\n\tcase xcoff.U802TOCMAGIC:\n\t\treturn \"ppc\"\n\tcase xcoff.U64_TOCMAGIC:\n\t\treturn \"ppc64\"\n\t}\n\treturn \"\"\n}","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/objfile/xcoff.go#L118-L154","documentation":"loadXCOFFTable slices a section's Data() between a start symbol's Value and an end symbol's Value, so both symbols must reside in the same XCOFF section. A mismatch would yield invalid offsets, so the loader refuses rather than return garbage or panic.","triggerScenarios":"Calling loadXCOFFTable where findXCOFFSymbol(sname).SectionNumber != findXCOFFSymbol(ename).SectionNumber.","commonSituations":"Corrupted or hand-edited XCOFF binary where the start/end markers of a table were relocated into different sections, or the wrong symbol pair for the binary's Go version.","solutions":["Rebuild the AIX binary cleanly.","Confirm the start/end symbol pair matches what the producer emitted."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// data, err := loadXCOFFTable(f, \"runtime.pclntab\", \"runtime.epclntab\")\n// if err != nil {\n//     if strings.Contains(err.Error(), \"must be in the same section\") {\n//         // XCOFF is corrupt or hand-edited; rebuild\n//     }\n//     return nil, err\n// }","preventionTips":["Feed only stock 'go build' AIX binaries to objfile tooling.","Avoid manual relocation/editing of XCOFF binaries.","Use the start/end symbol pair the producer actually emitted."],"tags":["xcoff","aix","binary","objfile","pclntab"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}