[llvm] [ObjCopy][DX] Support for -dump-section flag (PR #159999)
Chris B via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 11:18:41 PDT 2025
================
@@ -0,0 +1,283 @@
+# RUN: yaml2obj %s -o %t.dxbc
+# RUN: llvm-objcopy --dump-section=DXIL=%t.bc %t.dxbc
+# RUN: llvm-dis %t.bc -o - | FileCheck %s --check-prefix=BITCODE
+# RUN: wc -c %t.bc | FileCheck %s --check-prefix=DXIL-SIZE
+
+## Verify that when dumping the DXIL part we get a valid bitcode file.
+# BITCODE: define void @main()
+## Verify the size of the bitcode data.
+# DXIL-SIZE: 1708
+
+## Dump the PSV0 part and verify its size.
+# RUN: llvm-objcopy --dump-section=PSV0=%t.psv0 %t.dxbc
+# RUN: wc -c %t.psv0 | FileCheck %s --check-prefix=PSV0-SIZE
+# PSV0-SIZE: 76
----------------
llvm-beanz wrote:
This is binary data that's a bit awkward to match against. I think the best way to do this would be to also implement `-add-section` so that we could extract the data and then insert it into a new file and run `llvm-objdump` or `obj2yaml` to verify.
Do you have an alternate suggestion, or would you be okay with me filing an issue to track adding `-add-section` in a separate PR and fixing up the testing?
https://github.com/llvm/llvm-project/pull/159999
More information about the llvm-commits
mailing list