golang/go · error

dwarf: unsupported attribute form %d / class %d

Error message

dwarf: unsupported attribute form %d / class %d

What it means

Returned by putattr's default case when an attribute form/class pair is not handled by any explicit case in the switch (DW_FORM_strp and DW_FORM_indirect fall through to this default). The emitter only knows how to encode a fixed set of DWARF forms; anything else (form value or class value outside the supported matrix) is rejected to avoid emitting invalid DWARF.

Source

Thrown at src/cmd/internal/dwarf/dwarf.go:995

		if data == nil {
			return fmt.Errorf("dwarf: null reference in %d", abbrev)
		}
		ctxt.AddDWARFAddrSectionOffset(s, data, value)

	case DW_FORM_addrx: // index into .debug_addr section
		ctxt.AddIndirectTextRef(s, data)

	case DW_FORM_ref1, // reference within the compilation unit
		DW_FORM_ref2,      // reference
		DW_FORM_ref4,      // reference
		DW_FORM_ref8,      // reference
		DW_FORM_ref_udata, // reference

		DW_FORM_strp,     // string
		DW_FORM_indirect: // (see Section 7.5.3)
		fallthrough
	default:
		return fmt.Errorf("dwarf: unsupported attribute form %d / class %d", form, cls)
	}
	return nil
}

// PutAttrs writes the attributes for a DIE to symbol 's'.
//
// Note that we can (and do) add arbitrary attributes to a DIE, but
// only the ones actually listed in the Abbrev will be written out.
func PutAttrs(ctxt Context, s Sym, abbrev int, attr *DWAttr) {
	abbrevs := Abbrevs()
Outer:
	for _, f := range abbrevs[abbrev].attr {
		for ap := attr; ap != nil; ap = ap.Link {
			if ap.Atr == f.attr {
				putattr(ctxt, s, abbrev, int(f.form), int(ap.Cls), ap.Value, ap.Data)
				continue Outer
			}
		}

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Switch to a released Go toolchain — unsupported forms should not reach here in stable versions.
  2. Report the failing package + `go version -m` at https://go.dev/issue.
  3. Build with `-gcflags=-d=dwarf=false` or `-ldflags=-w` to bypass DWARF emission while the bug is fixed upstream.
  4. Bisect on toolchain version to identify the introducing change.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: The DWARF abbreviation for a DIE declares a form (e.g. DW_FORM_strx, DW_FORM_implicit_const, DW_FORM_line_strp) or a form/class combination that putattr does not implement. Like error 1235 this is an internal toolchain state mismatch, not a user-facing input.

Common situations: Tip/beta compiler builds with DWARF 5 experiments, third-party or in-progress patches that add forms without emitter support, or unusual compiler-generated abbreviations. Rare in released toolchains.

Related errors


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