golang/go · error

text section not found

Error message

text section not found

What it means

plan9File.text() fetches the 'text' section from a Plan 9 a.out object to extract executable code. If f.plan9.Section("text") returns nil, the object has no text segment and disassembly/extraction cannot proceed. This is hit by tools that read Plan 9 Go binaries (rare outside Plan 9 / 9front builds).

Source

Thrown at src/cmd/internal/objfile/plan9obj.go:90

}

func (f *plan9File) pcln() (textStart uint64, pclntab []byte, err error) {
	textStart = f.plan9.LoadAddress + f.plan9.HdrSize
	if pclntab, err = loadPlan9Table(f.plan9, "runtime.pclntab", "runtime.epclntab"); err != nil {
		// We didn't find the symbols, so look for the names used in 1.3 and earlier.
		// TODO: Remove code looking for the old symbols when we no longer care about 1.3.
		var err2 error
		if pclntab, err2 = loadPlan9Table(f.plan9, "pclntab", "epclntab"); err2 != nil {
			return 0, nil, err
		}
	}
	return textStart, pclntab, nil
}

func (f *plan9File) text() (textStart uint64, text []byte, err error) {
	sect := f.plan9.Section("text")
	if sect == nil {
		return 0, nil, fmt.Errorf("text section not found")
	}
	textStart = f.plan9.LoadAddress + f.plan9.HdrSize
	text, err = sect.Data()
	return
}

func findPlan9Symbol(f *plan9obj.File, name string) (*plan9obj.Sym, error) {
	syms, err := f.Symbols()
	if err != nil {
		return nil, err
	}
	for _, s := range syms {
		if s.Name != name {
			continue
		}
		return &s, nil
	}
	return nil, fmt.Errorf("no %s symbol found", name)

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Confirm the file is a Plan 9 executable produced for GOOS=plan9.
  2. Rebuild the Plan 9 binary.
  3. Make sure the objfile format detector selected the correct backend.
Defensive patterns

Strategy: try-catch

Try / catch

// textStart, text, err := pf.text()
// if err != nil {
//     if strings.Contains(err.Error(), "text section not found") {
//         // not an executable Plan 9 binary; nothing to disassemble
//     }
//     return err
// }

Prevention

When it happens

Trigger: Calling text() on a plan9File whose underlying plan9obj.File has no section named 'text' — e.g. a relocatable object, a data-only file, or a non-Plan-9 file misdetected as Plan 9.

Common situations: Cross-target confusion (running a Plan-9-targeted tool on a non-Plan-9 object), a stripped or partially-linked object, or file corruption.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/591c6da8db44a450. Report an issue: GitHub.