Skip to content

Commit

Permalink
[yaml2obj] - Allow using an arbitrary value for OSABI.
Browse files Browse the repository at this point in the history
There was no way to set an unsupported or unknown OS ABI.
With this patch it is possible to use any numeric value.

Differential revision: https://reviews.llvm.org/D71765
  • Loading branch information
Georgii Rymar committed Dec 23, 2019
1 parent 1f98577 commit f027e1a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/ObjectYAML/ELFYAML.cpp
Expand Up @@ -275,6 +275,7 @@ void ScalarEnumerationTraits<ELFYAML::ELF_ELFOSABI>::enumeration(
ECase(ELFOSABI_C6000_LINUX);
ECase(ELFOSABI_STANDALONE);
#undef ECase
IO.enumFallback<Hex8>(Value);
}

void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,
Expand Down
13 changes: 13 additions & 0 deletions llvm/test/tools/yaml2obj/ELF/header-osabi.yaml
Expand Up @@ -325,3 +325,16 @@ FileHeader:
Type: ET_REL
Machine: EM_X86_64
OSABI: ELFOSABI_STANDALONE

## Test we can use an arbitrary number for OSABI.
# RUN: yaml2obj %s --docnum=27 -o %t.number
# RUN: llvm-readobj --file-headers %t.number | FileCheck %s --check-prefix=OSABI-NUMBER
# OSABI-NUMBER: OS/ABI: 0xFE

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
OSABI: 0xFE

0 comments on commit f027e1a

Please sign in to comment.