Skip to content

llvm-readelf: Invalid JSON on PE (COFF) object #122805

Open
@sliedes

Description

@sliedes

Similar to, but distinct from, #88880

This is on LLVM 19.1.5 on NixOS.

Doing llvm-readelf --elf-outputs-style=JSON on a PE object (in this case an UEFI executable from a BIOS dump) produces invalid JSON. A small PE object attached to demonstrate.

$ file 137_PspDxe.efi
137_PspDxe.efi: PE32+ executable for EFI (boot service driver), x86-64, 4 sections

$ llvm-readelf --elf-output-style=JSON 137_PspDxe.efi
[
"File":"137_PspDxe.efi","Format":"COFF-x86-64","Arch":"x86_64","AddressSize":"64bit"]
$ llvm-readelf --version
LLVM (http://llvm.org/):
  LLVM version 19.1.5
  Optimized build.

The output is not valid JSON because key:value can only exist in an object ({}), and here it's in a list.

137_PspDxe.efi.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions