{"record":{"id":"b9f4a666056bdae8","repo":"rust-lang/rust","slug":"binary-format-is-not-supported","errorCode":null,"errorMessage":"binary format {:?} is not supported","messagePattern":"binary format (.+?) is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"library/compiler-builtins/crates/symbol-check/src/main.rs","lineNumber":425,"sourceCode":"    }\n\n    exit(1);\n}\n\n/// `Err` if the section/flag combination indicates that the object file should be linked with an\n/// executable stack.\nfn check_obj_exe_stack(obj: &ObjFile) -> Result<(), ExeStack> {\n    match obj.format() {\n        BinaryFormat::Elf => check_elf_exe_stack(obj),\n        // Technically has the `MH_ALLOW_STACK_EXECUTION` flag but I can't get the compiler to\n        // emit it (`-allow_stack_execute` doesn't seem to work in recent versions).\n        BinaryFormat::MachO => Ok(()),\n        // Can't find much information about Windows stack executability.\n        BinaryFormat::Coff | BinaryFormat::Pe => Ok(()),\n        // Also not sure about wasm.\n        BinaryFormat::Wasm => Ok(()),\n        BinaryFormat::Xcoff | _ => {\n            unimplemented!(\"binary format {:?} is not supported\", obj.format())\n        }\n    }\n}\n\n/// Check for an executable stack in elf binaries.\n///\n/// If the `PT_GNU_STACK` header on a binary is present and marked executable, the binary will\n/// have an executable stack (RWE rather than the desired RW). If any object file has the right\n/// `.note.GNU-stack` logic, the final binary will get `PT_GNU_STACK`.\n///\n/// Individual object file logic is as follows, paraphrased from [1]:\n///\n/// - A `.note.GNU-stack` section with the exe flag means this needs an executable stack\n/// - A `.note.GNU-stack` section without the exe flag means there is no executable stack needed\n/// - Without the section, behavior is target-specific. Historically it usually means an executable\n///   stack is required.\n///\n/// Per [2], it is now deprecated behavior for a missing `.note.GNU-stack` section to imply an","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/library/compiler-builtins/crates/symbol-check/src/main.rs#L407-L443","documentation":"compiler-builtins' symbol-check tool verifies that object files do not require an executable stack. In check_obj_exe_stack it handles Elf, MachO, Coff/Pe, and Wasm formats; for XCOFF or any other/unrecognized format it hits unimplemented!() (symbol-check/src/main.rs:425). The tool simply has no extractor for that binary format.","triggerScenarios":"Running the symbol-check binary (part of the compiler-builtins build/check pipeline) against an object file whose format is XCOFF (AIX) or any format outside {Elf, MachO, Coff, Pe, Wasm}. obj.format() returns something that falls through the match.","commonSituations":"Building or auditing compiler-builtins for an AIX/XCOFF target, or pointing symbol-check at an unusual object format (e.g. a raw relocatable or a new experimental format).","solutions":["Only run symbol-check against object files in a supported format (Elf/MachO/Coff/Pe/Wasm); skip XCOFF artifacts.","Filter input objects by format before calling check_obj_exe_stack, e.g. skip if matches!(obj.format(), BinaryFormat::Xcoff).","Upstream an XCOFF executable-stack checker if you need AIX support.","Run a different stack-audit tool (e.g. readelf/objdump) for the unsupported format."],"exampleFix":"// before\nlet r = check_obj_exe_stack(&obj);\n\n// after\nif !matches!(obj.format(), BinaryFormat::Elf | BinaryFormat::MachO | BinaryFormat::Coff | BinaryFormat::Pe | BinaryFormat::Wasm) {\n    println!(\"skipping {}: format {:?} unsupported\", obj.path().display(), obj.format());\n    continue;\n}\nlet r = check_obj_exe_stack(&obj);","handlingStrategy":"validation","validationCode":"use object::BinaryFormat;\nfn is_stack_check_supported(fmt: BinaryFormat) -> bool {\n    matches!(fmt, BinaryFormat::Elf | BinaryFormat::MachO | BinaryFormat::Coff | BinaryFormat::Pe | BinaryFormat::Wasm)\n}\n// Only call check_obj_exe_stack when is_stack_check_supported(obj.format()) is true.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter object files by BinaryFormat before stack-auditing.","Skip XCOFF and unknown formats in your symbol-check pipeline.","Run a target-specific stack auditor for unsupported formats."],"tags":["compiler-builtins","build-tool","binary-format","xcoff","executable-stack"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}