[PATCH] D58383: [yaml2obj][obj2yaml] Remove section type range markers from allowed mappings and support hex values

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 19 08:22:03 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL354344: [yaml2obj][obj2yaml] Remove section type range markers from allowed mappingsā€¦ (authored by jhenderson, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58383?vs=187362&id=187378#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58383/new/

https://reviews.llvm.org/D58383

Files:
  llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
  llvm/trunk/test/tools/obj2yaml/section-type.yaml
  llvm/trunk/test/tools/yaml2obj/section-type.yaml


Index: llvm/trunk/test/tools/yaml2obj/section-type.yaml
===================================================================
--- llvm/trunk/test/tools/yaml2obj/section-type.yaml
+++ llvm/trunk/test/tools/yaml2obj/section-type.yaml
@@ -0,0 +1,27 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-readobj --sections %t | FileCheck %s
+
+# CHECK: Name: enum
+# CHECK: Type: SHT_PROGBITS
+# CHECK: Name: machine-specific
+# CHECK: Type: SHT_X86_64_UNWIND
+# CHECK: Name: hex
+# CHECK: Type: Unknown (0xABCD)
+# CHECK: Name: decimal
+# CHECK: Type: Unknown (0x4D2)
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:  enum
+    Type:  SHT_PROGBITS
+  - Name:  machine-specific
+    Type:  SHT_X86_64_UNWIND
+  - Name:  hex
+    Type:  0xabcd
+  - Name:  decimal
+    Type:  1234
Index: llvm/trunk/test/tools/obj2yaml/section-type.yaml
===================================================================
--- llvm/trunk/test/tools/obj2yaml/section-type.yaml
+++ llvm/trunk/test/tools/obj2yaml/section-type.yaml
@@ -0,0 +1,28 @@
+# RUN: yaml2obj %s -o %t
+# RUN: obj2yaml %t | FileCheck %s
+
+# CHECK:      Sections:
+# CHECK-NEXT:   - Name: known_type
+# CHECK-NEXT:     Type: SHT_PROGBITS
+# CHECK:        - Name: unknown_type
+# CHECK-NEXT:     Type: 0x0000ABCD
+# CHECK:        - Name: machine_specific
+# CHECK-NEXT:     Type: SHT_X86_64_UNWIND
+# CHECK:        - Name: unknown_machine_specific
+# CHECK-NEXT:     Type: 0x70000000
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_REL
+  Machine: EM_X86_64
+Sections:
+  - Name:  known_type
+    Type:  SHT_PROGBITS
+  - Name:  unknown_type
+    Type:  0xabcd
+  - Name:  machine_specific
+    Type:  SHT_X86_64_UNWIND
+  - Name:  unknown_machine_specific
+    Type:  0x70000000
Index: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
===================================================================
--- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
+++ llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
@@ -446,7 +446,6 @@
   ECase(SHT_GROUP);
   ECase(SHT_SYMTAB_SHNDX);
   ECase(SHT_RELR);
-  ECase(SHT_LOOS);
   ECase(SHT_ANDROID_REL);
   ECase(SHT_ANDROID_RELA);
   ECase(SHT_ANDROID_RELR);
@@ -459,8 +458,6 @@
   ECase(SHT_GNU_verdef);
   ECase(SHT_GNU_verneed);
   ECase(SHT_GNU_versym);
-  ECase(SHT_HIOS);
-  ECase(SHT_LOPROC);
   switch (Object->Header.Machine) {
   case ELF::EM_ARM:
     ECase(SHT_ARM_EXIDX);
@@ -485,6 +482,7 @@
     break;
   }
 #undef ECase
+  IO.enumFallback<Hex32>(Value);
 }
 
 void ScalarBitSetTraits<ELFYAML::ELF_PF>::bitset(IO &IO,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58383.187378.patch
Type: text/x-patch
Size: 2600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190219/8738ce7f/attachment.bin>


More information about the llvm-commits mailing list