[yaml2obj] - Don't crash when `FileHeader` declares an empty `Flags` key in specific...
authorGeorgii Rymar <grimar@accesssoftek.com>
Tue, 18 Aug 2020 12:52:09 +0000 (15:52 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Tue, 18 Aug 2020 13:09:28 +0000 (16:09 +0300)
commitbd7daf5ceb92db00d3fc5d1ce8d4f74dcd03ebb9
treee99ee649d7bf516bf6cf2f7328b47546c703a279
parent1b93ebccaa094c079db7ad729e2f7fea7bac2f34
[yaml2obj] - Don't crash when `FileHeader` declares an empty `Flags` key in specific situations.

We currently call the `llvm_unreachable` for the following YAML:

```
--- !ELF
FileHeader:
  Class:   ELFCLASS32
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_NONE
  Flags:   [ ]
```

it happens because the `Flags` key is present, though `EM_NONE` is a
machine type that has no known `EF_*` values and we call `llvm_unreachable` by mistake.

Differential revision: https://reviews.llvm.org/D86138
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/test/tools/yaml2obj/ELF/eflags.yaml [new file with mode: 0644]