[PATCH] D71765: [yaml2obj] - Allow using an arbitrary value for OSABI.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 06:48:32 PST 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar added a parent revision: D71764: [yaml2obj] - Add support for ELFOSABI_LINUX..
grimar added a child revision: D71766: [llvm-readobj/llvm-readelf][test] - Add testing for EI_OSABI and EI_ABIVERSION fields of an ELF header..

There was no way to set an unsupported or unknown OS ABI.
With this patch it is possible to use any numeric value.

Depends on: https://reviews.llvm.org/D71764


https://reviews.llvm.org/D71765

Files:
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/test/tools/yaml2obj/ELF/header-osabi.yaml


Index: llvm/test/tools/yaml2obj/ELF/header-osabi.yaml
===================================================================
--- llvm/test/tools/yaml2obj/ELF/header-osabi.yaml
+++ llvm/test/tools/yaml2obj/ELF/header-osabi.yaml
@@ -325,3 +325,16 @@
   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
Index: llvm/lib/ObjectYAML/ELFYAML.cpp
===================================================================
--- llvm/lib/ObjectYAML/ELFYAML.cpp
+++ llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -275,6 +275,7 @@
   ECase(ELFOSABI_C6000_LINUX);
   ECase(ELFOSABI_STANDALONE);
 #undef ECase
+  IO.enumFallback<Hex8>(Value);
 }
 
 void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71765.234886.patch
Type: text/x-patch
Size: 1037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191220/3778a82c/attachment-0001.bin>


More information about the llvm-commits mailing list