golang/go · warning
unknown load address
Error message
unknown load address
What it means
When analyzing a Mach-O binary, `machoFile.loadAddress()` looks for the `__TEXT` segment to determine the base load address. If no `__TEXT` segment exists, this error is returned. The `__TEXT` segment is standard in all macOS executables and shared libraries; its absence indicates a non-standard or corrupt Mach-O file.
Source
Thrown at src/cmd/internal/objfile/macho.go:124
case macho.Cpu386:
return "386"
case macho.CpuAmd64:
return "amd64"
case macho.CpuArm:
return "arm"
case macho.CpuArm64:
return "arm64"
case macho.CpuPpc64:
return "ppc64"
}
return ""
}
func (f *machoFile) loadAddress() (uint64, error) {
if seg := f.macho.Segment("__TEXT"); seg != nil {
return seg.Addr, nil
}
return 0, fmt.Errorf("unknown load address")
}
func (f *machoFile) dwarf() (*dwarf.Data, error) {
return f.macho.DWARF()
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Verify the `__TEXT` segment exists: `otool -l <file> | grep __TEXT`.
- Rebuild the binary with standard macOS linking.
- Ensure the file is a genuine Mach-O executable: `file <path>`.
- If the binary is corrupt, re-download or rebuild it.
Example fix
// before — Mach-O with no __TEXT segment
f, err := objfile.Open("weird_bin")
addr, err := f.LoadAddress() // fails
// after — use a properly linked macOS binary
f, err := objfile.Open("go_binary")
addr, err := f.LoadAddress() // succeeds Defensive patterns
Strategy: fallback
Validate before calling
// Check for __TEXT segment in Mach-O
func hasTextSegment(path string) bool {
f, err := macho.Open(path)
if err != nil { return false }
defer f.Close()
return f.Segment("__TEXT") != nil
} Try / catch
addr, err := f.LoadAddress()
if err != nil && strings.Contains(err.Error(), "unknown load address") {
// Non-standard Mach-O; use 0 as fallback
addr = 0
} Prevention
- Verify __TEXT segment exists with 'otool -l <file> | grep __TEXT'.
- Ensure the binary is a genuine Mach-O executable: 'file <path>'.
- Re-download or rebuild corrupt binaries before analysis.
When it happens
Trigger: Calling `File.LoadAddress()` on a Mach-O file whose segment list does not include `__TEXT`. Occurs with non-standard Mach-O files, corrupted binaries, or Mach-O files generated by tools that use non-standard segment naming.
Common situations: Analyzing a stripped or post-processed macOS binary. Pointing pprof at a Mach-O file that is not a normal executable (e.g., a symbol stub, a kernel extension with non-standard layout). Corrupt Mach-O headers from incomplete downloads or filesystem issues.
Related errors
- text section not found
- text section not found
- unknown load address
- unknown load address
- text section not found
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/b0463c6909c7734e.
Report an issue: GitHub.