[all-commits] [llvm/llvm-project] bd7daf: [yaml2obj] - Don't crash when `FileHeader` declare...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Tue Aug 18 06:10:08 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: bd7daf5ceb92db00d3fc5d1ce8d4f74dcd03ebb9
      https://github.com/llvm/llvm-project/commit/bd7daf5ceb92db00d3fc5d1ce8d4f74dcd03ebb9
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-08-18 (Tue, 18 Aug 2020)

  Changed paths:
    M llvm/lib/ObjectYAML/ELFYAML.cpp
    A llvm/test/tools/yaml2obj/ELF/eflags.yaml

  Log Message:
  -----------
  [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




More information about the All-commits mailing list