{"record":{"id":"d25434f02ac1d487","repo":"golang/go","slug":"arm-attributes-has-unexpected-format-c","errorCode":null,"errorMessage":".ARM.attributes has unexpected format %c\n","messagePattern":"\\.ARM\\.attributes has unexpected format %c\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/link/internal/loadelf/ldelf.go","lineNumber":193,"sourceCode":"}\n\nfunc (a *elfAttributeList) done() bool {\n\tif a.err != nil || len(a.data) == 0 {\n\t\treturn true\n\t}\n\treturn false\n}\n\n// Look for the attribute that indicates the object uses the hard-float ABI (a\n// file-level attribute with tag Tag_VFP_arch and value 1). Unfortunately the\n// format used means that we have to parse all of the file-level attributes to\n// find the one we are looking for. This format is slightly documented in \"ELF\n// for the ARM Architecture\" but mostly this is derived from reading the source\n// to gold and readelf.\nfunc parseArmAttributes(e binary.ByteOrder, data []byte) (found bool, ehdrFlags uint32, err error) {\n\tfound = false\n\tif data[0] != 'A' {\n\t\treturn false, 0, fmt.Errorf(\".ARM.attributes has unexpected format %c\\n\", data[0])\n\t}\n\tdata = data[1:]\n\tfor len(data) != 0 {\n\t\tsectionlength := e.Uint32(data)\n\t\tsectiondata := data[4:sectionlength]\n\t\tdata = data[sectionlength:]\n\n\t\tnulIndex := bytes.IndexByte(sectiondata, 0)\n\t\tif nulIndex < 0 {\n\t\t\treturn false, 0, fmt.Errorf(\"corrupt .ARM.attributes (section name not NUL-terminated)\\n\")\n\t\t}\n\t\tname := string(sectiondata[:nulIndex])\n\t\tsectiondata = sectiondata[nulIndex+1:]\n\n\t\tif name != \"aeabi\" {\n\t\t\tcontinue\n\t\t}\n\t\tfor len(sectiondata) != 0 {","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/loadelf/ldelf.go#L175-L211","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Regenerate the ARM object with a mainstream GCC/Clang version whose `.ARM.attributes` starts with `'A'`.","`go clean -cache && go build -a` to rebuild all ARM objects.","Inspect the section: `readelf -A <obj>` — if it errors, the object is non-conformant.","Upgrade Go; newer releases tolerate a wider range of attribute formats."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Validate ARM objects' attribute sections before linking\nfor obj in $(find build -name '*.o'); do\n  if readelf -S \"$obj\" 2>/dev/null | grep -q .ARM.attributes; then\n    readelf -A \"$obj\" >/dev/null 2>&1 || echo \"bad ARM attributes in $obj\"\n  fi\ndone","typeGuard":null,"tryCatchPattern":"set +e\ngo build ./...\nrc=$?\nset -e\nif [ $rc -ne 0 ]; then\n  go clean -cache && go build -a ./...\nfi","preventionTips":["Use a mainstream, stable GCC/Clang for ARM cross-compilation.","Validate `.ARM.attributes` with `readelf -A` in CI.","Upgrade Go to tolerate a broader range of attribute formats."],"tags":["linker","go-toolchain","arm","elf","abi","hard-float"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}