This adds support for the `-dump-section=<section>=<file>` flag for the DXContainer file format. This flag dumps the contents of a named section to the specified file. This flag is particularly handy for ripping DXIL bitcode out of the object files so that we can use LLVM tools to inspect and operate on the bitcode. To facilitate that workflow this flag also strips the program headers from parts containing DXIL so that the resulting file is a valid bitcode file. --------- Co-authored-by: Justin Bogner <mail@justinbogner.com>
28 lines
961 B
YAML
28 lines
961 B
YAML
# RUN: yaml2obj %s -o %t.dxbc
|
|
# RUN: not llvm-objcopy --dump-section=FKE0=%t.fek0 %t.dxbc 2>&1 | FileCheck %s --check-prefix=CHECK-ZEROSIZE -DFILE=%t.fek0
|
|
# RUN: not llvm-objcopy --dump-section=FKE3=%t.fek1 %t.dxbc 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING -DFILE=%t.fek1
|
|
# RUN: not llvm-objcopy --dump-section=FKE2=%t/does_not_exist/.fek2 %t.dxbc 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-PATH -DFILE=%t/does_not_exist/.fek2 -DMSG=%errc_ENOENT
|
|
|
|
# CHECK-ZEROSIZE: error: '[[FILE]]': part 'FKE0' is empty
|
|
# CHECK-MISSING: error: '[[FILE]]': part 'FKE3' not found
|
|
# CHECK-BAD-PATH: error: '[[FILE]]': [[MSG]]
|
|
|
|
--- !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: 108
|
|
PartCount: 3
|
|
PartOffsets: [ 60, 68, 76 ]
|
|
Parts:
|
|
- Name: FKE0
|
|
Size: 0
|
|
- Name: FKE1
|
|
Size: 0
|
|
- Name: FKE2
|
|
Size: 8
|
|
...
|