[llvm-branch-commits] [llvm] [DirectX] Add support for `remove-section` of `DXContainer` for `llvm-objcopy` (PR #153246)

Helena Kotas via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 13 15:15:54 PDT 2025


================
@@ -0,0 +1,50 @@
+## Tests that the copied DXContainer correctly has the specified headers
+## removed.
+
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objcopy --remove-section=FKE1 --remove-section=FKE4 %t %t.out
+# RUN: obj2yaml %t.out | FileCheck %s
+
+--- !dxcontainer
+Header:
+  Hash:            [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+                     0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
+  Version:
+    Major:           1
+    Minor:           0
+## FileSize = 1996 - 8 (FKE0 content) - 1688 (FKE4 content)
+##          - 8 (2 part offsets) - 16 (2 part headers)
+##          = 276
+## CHECK: FileSize:       276
+  FileSize:        1996
+## CHECK: PartCount:      5
+  PartCount:       7
+## CHECK: PartOffsets:    [ 52, 68, 84, 212, 240 ]
+  PartOffsets:     [ 60, 76, 92, 108, 236, 1932, 1960 ]
+Parts:
+## CHECK-NOT: FKE1
+## CHECK-NOT: FKE4
----------------
hekota wrote:

```suggestion
# CHECK: FileSize:       276
  FileSize:        1996
# CHECK: PartCount:      5
  PartCount:       7
# CHECK: PartOffsets:    [ 52, 68, 84, 212, 240 ]
  PartOffsets:     [ 60, 76, 92, 108, 236, 1932, 1960 ]
Parts:
# CHECK-NOT: FKE1
# CHECK-NOT: FKE4
```

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


More information about the llvm-branch-commits mailing list