golang/go · error
%s and %s symbols must be in the same section
Error message
%s and %s symbols must be in the same section
What it means
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.
Source
Thrown at src/cmd/internal/objfile/xcoff.go:136
if len(f.Sections) < s.SectionNumber {
return nil, fmt.Errorf("symbol %s: section number %d is larger than max %d", name, s.SectionNumber, len(f.Sections))
}
return s, nil
}
return nil, fmt.Errorf("no %s symbol found", name)
}
func loadXCOFFTable(f *xcoff.File, sname, ename string) ([]byte, error) {
ssym, err := findXCOFFSymbol(f, sname)
if err != nil {
return nil, err
}
esym, err := findXCOFFSymbol(f, ename)
if err != nil {
return nil, err
}
if ssym.SectionNumber != esym.SectionNumber {
return nil, fmt.Errorf("%s and %s symbols must be in the same section", sname, ename)
}
sect := f.Sections[ssym.SectionNumber-1]
data, err := sect.Data()
if err != nil {
return nil, err
}
return data[ssym.Value:esym.Value], nil
}
func (f *xcoffFile) goarch() string {
switch f.xcoff.TargetMachine {
case xcoff.U802TOCMAGIC:
return "ppc"
case xcoff.U64_TOCMAGIC:
return "ppc64"
}
return ""
}View on GitHub (pinned to b6b368adc5)
Solutions
- Rebuild the AIX binary cleanly.
- Confirm the start/end symbol pair matches what the producer emitted.
Defensive patterns
Strategy: try-catch
Try / catch
// data, err := loadXCOFFTable(f, "runtime.pclntab", "runtime.epclntab")
// if err != nil {
// if strings.Contains(err.Error(), "must be in the same section") {
// // XCOFF is corrupt or hand-edited; rebuild
// }
// return nil, err
// } Prevention
- 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.
When it happens
Trigger: Calling loadXCOFFTable where findXCOFFSymbol(sname).SectionNumber != findXCOFFSymbol(ename).SectionNumber.
Common situations: 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.
Related errors
- invalid section number in symbol table
- text section not found
- symbol %s: section number %d is larger than max %d
- no %s symbol found
- %s and %s symbols must be in the same section
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/8cc3afa90f2fa210.
Report an issue: GitHub.