Issue 122805
Summary llvm-readelf: Invalid JSON on PE (COFF) object
Labels new issue
Assignees
Reporter 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](https://github.com/user-attachments/files/18402591/137_PspDxe.efi.zip)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to