{"record":{"id":"164ba3ec116cc394","repo":"go-delve/delve","slug":"architecture-not-supported","errorCode":null,"errorMessage":"architecture not supported","messagePattern":"architecture not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/bininfo.go","lineNumber":1990,"sourceCode":"\t\t// The TLS register points to the end of the TLS block, which is\n\t\t// tls.Memsz long. runtime.tlsg is an offset from the beginning of that block.\n\t\tbi.gStructOffset = ^(memsz) + 1 + tlsg.Value // -tls.Memsz + tlsg.Value\n\n\tcase elf.EM_AARCH64:\n\t\ttlsg := getSymbol(image, bi.logger, exe, \"runtime.tls_g\")\n\t\tif tlsg == nil || tls == nil {\n\t\t\tbi.gStructOffset = 2 * uint64(bi.Arch.PtrSize())\n\t\t\treturn\n\t\t}\n\n\t\tbi.gStructOffset = tlsg.Value + uint64(bi.Arch.PtrSize()*2) + ((tls.Vaddr - uint64(bi.Arch.PtrSize()*2)) & (tls.Align - 1))\n\n\tcase elf.EM_PPC64, elf.EM_RISCV, elf.EM_LOONGARCH:\n\t\t_ = getSymbol(image, bi.logger, exe, \"runtime.tls_g\")\n\n\tdefault:\n\t\t// we should never get here\n\t\tpanic(\"architecture not supported\")\n\t}\n}\n\nfunc getSymbol(image *Image, logger logflags.Logger, exe *elf.File, name string) *elf.Symbol {\n\tsymbols, err := exe.Symbols()\n\tif err != nil {\n\t\timage.setLoadError(logger, \"could not parse ELF symbols: %v\", err)\n\t\treturn nil\n\t}\n\n\tfor _, symbol := range symbols {\n\t\tif symbol.Name == name {\n\t\t\ts := symbol\n\t\t\treturn &s\n\t\t}\n\t}\n\treturn nil\n}","sourceCodeStart":1972,"sourceCodeEnd":2008,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/bininfo.go#L1972-L2008","documentation":"During binary info loading, Delve resolves architecture-specific TLS runtime symbols (runtime.tls_g and friends). pkg/proc/bininfo.go panics with \"architecture not supported\" when the ELF machine type is not one of the explicitly handled architectures (amd64, arm64, 386, arm, ppc64le, riscv64, loongarch in the switch). The comment states \"we should never get here\" — an internal invariant violation indicating an architecture reached symbol loading without being registered as supported.","triggerScenarios":"Loading a binary whose elf.Machine falls in the default branch of the TLS symbol switch — i.e. a target architecture Delve does not support (s390x, mips, sparc, etc.) or a corrupted e_machine field.","commonSituations":"Attempting to debug binaries for unsupported architectures; corrupted ELF headers with a bogus e_machine value; custom/foreign toolchain outputs; misdetected binary format.","solutions":["Debug a binary built for a supported architecture (amd64, arm64, 386, arm, ppc64le, riscv64, loongarch).","Verify the ELF header's e_machine field is valid; a corrupted header can hit the default branch.","Check Delve's version — newer releases add architectures; upgrade if your target was recently supported.","Check how the architecture was detected upstream (GOARCH/elf machine mapping in bininfo) if it should have been handled."],"exampleFix":"// before\ndefault:\n\tpanic(\"architecture not supported\")\n// after\ndefault:\n\treturn fmt.Errorf(\"architecture %v not supported for TLS symbol resolution\", exe.Machine)","handlingStrategy":"validation","validationCode":"// Go: check supported ELF machines before loading bininfo\nvar supported = map[elf.Machine]bool{\n\telf.EM_X86_64: true, elf.EM_AARCH64: true, elf.EM_386: true, elf.EM_ARM: true,\n\telf.EM_PPC64: true, elf.EM_RISCV: true, elf.EM_LOONGARCH: true,\n}\nif !supported[exe.Machine] {\n\treturn fmt.Errorf(\"architecture %v not supported\", exe.Machine)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only debug binaries built for Delve-supported architectures","Validate e_machine in the ELF header is a known value","Upgrade Delve when targeting newly supported architectures","Recover() around bininfo loading when processing arbitrary files"],"tags":["proc","elf","architecture","tls","panic"],"backgroundTag":"unsupported-architecture","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}