[llvm] [DirectX] Add boilerplate integration of `objcopy` for `DXContainerObjectFile` (PR #153079)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 01:50:17 PDT 2025


================
@@ -0,0 +1,46 @@
+## Check that llvm-objcopy reports a suitable error when it
+## encounters an invalid input during reading. The purpose is not to have
+## extensive of all read errors, that should be done in DXContainerTest.cpp,
+## instead this is a sanity check that the error is produced when using the
+## reader in llvm-objcopy.
+
+## We can't have multiple DXIL parts.
+# RUN: yaml2obj %s --docnum=1 -o %t1
+# RUN: not llvm-objcopy %t1 %t1.out 2>&1 | FileCheck %s -DFILE=%t1 --check-prefix=ERROR1
+
+# ERROR1: error: '[[FILE]]': More than one DXIL part is present in the file
+
+--- !dxcontainer
+Header:
+  Hash:            [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+                     0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
+  Version:
+    Major:           1
+    Minor:           0
+  PartCount:       2
+Parts:
+  - Name:            DXIL
+    Size:            28
+  - Name:            DXIL
+    Size:            28
+...
+
+## The first part offset is out of file bound.
----------------
jh7370 wrote:

```suggestion
## The first part offset is out of file bounds.
```

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


More information about the llvm-commits mailing list