[llvm] [yaml2obj] Don't use uninitialized Type (PR #123274)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 00:52:47 PST 2025


================
@@ -25,3 +25,31 @@ Sections:
     Type:  0xabcd
   - Name:  decimal
     Type:  1234
+
+
+# RUN: not yaml2obj %s --docnum=2 -o %t2 2>&1 | FileCheck %s --check-prefix=UNKNOWN-TYPE
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_REL
+Sections:
+  - Name: .foo
+    Type: FOO_SECTION
----------------
jh7370 wrote:

Nit: in the ObjectYAML code, this case isn't (supposed to be) treated as a section at all, but rather a higher-level concept called a "Chunk", so I'd rename it to `FOO_CHUNK`. Sections are those where the type starts with "SHT_".

https://github.com/llvm/llvm-project/pull/123274


More information about the llvm-commits mailing list