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>
This pr adds the `extract-section` option to `llvm-objcopy` as a common
option. It differs from `dump-section` as it will produce a standalone
object with just one section, as opposed to just the section contents.
For more context as to other options considered, see
https://github.com/llvm/llvm-project/pull/153265#issuecomment-3195696003.
This difference in behaviour is used for DXC compatibility with
`extract-rootsignature` and `/Frs`.
This pr then implements this functionality for `DXContainer` objects.
This is the second step of
https://github.com/llvm/llvm-project/issues/150277 to implement as a
compiler action that invokes `llvm-objcopy` for functionality.
This also completes the implementation of `extract-rootsignature` as
described in https://github.com/llvm/llvm-project/issues/149560.
This pr implements the `only-section` option for a `DXContainer` object
in `llvm-objcopy`.
It extends the base `removeParts` of the minimal object representation
of a `DXContainerObject`.
This a pre-requisite step to implement
https://github.com/llvm/llvm-project/issues/150286 as a way to strip all
other information away.
This pr implements the `remove-section` option for a `DXContainer`
object in `llvm-objcopy`.
It implements a base `removeParts` to the minimal `object`
representation of a `DXContainerObject`.
This is the second step to implement
https://github.com/llvm/llvm-project/issues/150275 as a compiler actions
that invokes llvm-objcopy for functionality.
This pr implements the boiler plate required to use `llvm-objcopy` for
`DXContainer` object files.
It defines a minimal structure `object` to represent the `DXContainer`
header and the following parts.
This structure is a simple representation of the object data to allow
for simple modifications at the granularity of each part. It follows
similarily to how the respective `object`s are defined for `ELF`,
`wasm`, `XCOFF`, etc.
This is the first step to implement
https://github.com/llvm/llvm-project/issues/150275 and
https://github.com/llvm/llvm-project/issues/150277 as compiler actions
that invoke `llvm-objcopy` for functionality.