golang/go · error

.ARM.attributes has unexpected format %c

Error message

.ARM.attributes has unexpected format %c

What it means

ARM ELF objects carry a `.ARM.attributes` section describing ABI properties (hard/soft-float, arch version). The section must begin with the byte `'A'` (version 1, the only defined format) per the "ELF for the ARM Architecture" ABI. Any other first byte means the section is in an unknown/unsupported format, so the linker cannot determine the correct ELF header flags (notably the hard-float ABI flag) and aborts.

Source

Thrown at src/cmd/link/internal/loadelf/ldelf.go:193

}

func (a *elfAttributeList) done() bool {
	if a.err != nil || len(a.data) == 0 {
		return true
	}
	return false
}

// Look for the attribute that indicates the object uses the hard-float ABI (a
// file-level attribute with tag Tag_VFP_arch and value 1). Unfortunately the
// format used means that we have to parse all of the file-level attributes to
// find the one we are looking for. This format is slightly documented in "ELF
// for the ARM Architecture" but mostly this is derived from reading the source
// to gold and readelf.
func parseArmAttributes(e binary.ByteOrder, data []byte) (found bool, ehdrFlags uint32, err error) {
	found = false
	if data[0] != 'A' {
		return false, 0, fmt.Errorf(".ARM.attributes has unexpected format %c\n", data[0])
	}
	data = data[1:]
	for len(data) != 0 {
		sectionlength := e.Uint32(data)
		sectiondata := data[4:sectionlength]
		data = data[sectionlength:]

		nulIndex := bytes.IndexByte(sectiondata, 0)
		if nulIndex < 0 {
			return false, 0, fmt.Errorf("corrupt .ARM.attributes (section name not NUL-terminated)\n")
		}
		name := string(sectiondata[:nulIndex])
		sectiondata = sectiondata[nulIndex+1:]

		if name != "aeabi" {
			continue
		}
		for len(sectiondata) != 0 {

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Regenerate the ARM object with a mainstream GCC/Clang version whose `.ARM.attributes` starts with `'A'`.
  2. `go clean -cache && go build -a` to rebuild all ARM objects.
  3. Inspect the section: `readelf -A <obj>` — if it errors, the object is non-conformant.
  4. Upgrade Go; newer releases tolerate a wider range of attribute formats.
Defensive patterns

Strategy: validation

Validate before calling

# Validate ARM objects' attribute sections before linking
for obj in $(find build -name '*.o'); do
  if readelf -S "$obj" 2>/dev/null | grep -q .ARM.attributes; then
    readelf -A "$obj" >/dev/null 2>&1 || echo "bad ARM attributes in $obj"
  fi
done

Try / catch

set +e
go build ./...
rc=$?
set -e
if [ $rc -ne 0 ]; then
  go clean -cache && go build -a ./...
fi

Prevention

When it happens

Trigger: Loading an ARM object whose `.ARM.attributes` section was produced by a non-conforming or experimental toolchain; a corrupted object whose attribute section bytes are wrong; an object targeting a future attribute format version not yet supported by this Go release.

Common situations: Cross-compiling for ARM with a very new or very old GCC/Clang that emits a non-`'A'`-prefixed attributes section; bit-rot in a cached object; objects passed through a converter that altered the section.

Related errors


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