{"record":{"id":"eeebdef84b0e56b4","repo":"golang/go","slug":"could-not-parse-arm-attributes","errorCode":null,"errorMessage":"could not parse .ARM.attributes\n","messagePattern":"could not parse \\.ARM\\.attributes\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/link/internal/loadelf/ldelf.go","lineNumber":229,"sourceCode":"\t\tfor len(sectiondata) != 0 {\n\t\t\tsubsectiontag, sz := binary.Uvarint(sectiondata)\n\t\t\tsubsectionsize := e.Uint32(sectiondata[sz:])\n\t\t\tsubsectiondata := sectiondata[sz+4 : subsectionsize]\n\t\t\tsectiondata = sectiondata[subsectionsize:]\n\n\t\t\tif subsectiontag != TagFile {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tattrList := elfAttributeList{data: subsectiondata}\n\t\t\tfor !attrList.done() {\n\t\t\t\tattr := attrList.armAttr()\n\t\t\t\tif attr.tag == TagABIVFPArgs && attr.ival == 1 {\n\t\t\t\t\tfound = true\n\t\t\t\t\tehdrFlags = 0x5000402 // has entry point, Version5 EABI, hard-float ABI\n\t\t\t\t}\n\t\t\t}\n\t\t\tif attrList.err != nil {\n\t\t\t\treturn false, 0, fmt.Errorf(\"could not parse .ARM.attributes\\n\")\n\t\t\t}\n\t\t}\n\t}\n\treturn found, ehdrFlags, nil\n}\n\n// Load loads the ELF file pn from f.\n// Symbols are installed into the loader, and a slice of the text symbols is returned.\n//\n// On ARM systems, Load will attempt to determine what ELF header flags to\n// emit by scanning the attributes in the ELF file being loaded. The\n// parameter initEhdrFlags contains the current header flags for the output\n// object, and the returned ehdrFlags contains what this Load function computes.\n// TODO: find a better place for this logic.\nfunc Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader, pkg string, length int64, pn string, initEhdrFlags uint32) (textp []loader.Sym, ehdrFlags uint32, err error) {\n\terrorf := func(str string, args ...any) ([]loader.Sym, uint32, error) {\n\t\treturn nil, 0, fmt.Errorf(\"loadelf: %s: %v\", pn, fmt.Sprintf(str, args...))\n\t}","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/loadelf/ldelf.go#L211-L247","documentation":"Inside the `aeabi` subsection, `.ARM.attributes` carries a list of (tag,value) attributes parsed by `elfAttributeList.armAttr()`. If that parser records an internal error (`attrList.err != nil`) — e.g. a ULEB128 tag that overruns the buffer, an attribute value of the wrong type, or a subsection size that does not match its contents — the linker reports a generic parse failure, because it cannot reliably determine attributes like `Tag_VFP_args` (the hard-float ABI marker).","triggerScenarios":"An ARM object with a malformed attribute value (truncated ULEB128, integer where a string is expected); a subsection whose declared size disagrees with its bytes; an object from a toolchain emitting attributes the parser does not understand.","commonSituations":"Cross-compiling with an unusual or experimental ARM toolchain; corrupted cache; object generated by a custom assembler emitting non-standard tags.","solutions":["Rebuild the ARM object with a mainstream, stable GCC/Clang release.","`go clean -cache && go build -a` to flush any corrupt objects.","Inspect with `readelf -A <obj>`; if it reports errors, the object is the problem.","Upgrade Go — attribute parsing has been hardened across releases."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for obj in $(find build -name '*.o'); do\n  readelf -A \"$obj\" >/dev/null 2>&1 || echo \"unparseable ARM attributes in $obj\"\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 stable ARM toolchain.","Upgrade Go for hardened attribute parsing.","Validate objects with `readelf -A` before linking."],"tags":["linker","go-toolchain","arm","elf","abi","attributes"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}