aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ObjectYAML
AgeCommit message (Collapse)AuthorFilesLines
5 days[HLSL] Update Frontend to support version 1.2 of root signature (#160616)joaosaffran1-1/+1
This patch updates the frontend to support version 1.2 of root signatures, it adds parsing, metadata generation and a few tests. --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
10 days[DirectX] Updating DXContainer logic to read version 1.2 of static samplers ↵joaosaffran1-0/+5
(#160184) This PR is updating `Object/DXContainer.h` so that we can read data from root signature version 1.2, which adds flags into static samplers.
10 days[DirectX] Updating DXContainer Yaml to represent Root Signature 1.2 (#159659)joaosaffran2-0/+15
This PR updates the YAML representation of DXContainer to support Root Signature 1.2, this also requires updating the write logic to support testing.
2025-09-22[BinaryFormat][ELF] Rename machine type INTEL205 to INTELGT (#159791)Nick Sarnie1-0/+1
`EM_INTEL205` was renamed to `EM_INTELGT` (ref [here](https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=7b9f985957798ba4dacc454f22c9e426c6897cb8)) and is used for Intel GPU images. We will be using this type for offloading to Intel GPUs. --------- Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-09-18[llvm][yaml2obj] Modify section header overriding timing (#130942)Ruoyu Qiu1-4/+18
yaml2obj should determine the program header offset (and other properties) based on the intended values rather than the final `sh_offset` of the section header. `setProgramHeaderLayout` uses section offsets for determining `p_offset`. Move section header overriding after `setProgramHeaderLayout` to prevent `ShOffset` from affecting program header `p_offset`. This change adjusts the timing of when the section header is overridden to ensure that the program headers are set correctly. More details [here](https://github.com/llvm/llvm-project/pull/126537#issuecomment-2700421989). --------- Signed-off-by: Ruoyu Qiu <cabbaken@outlook.com> Signed-off-by: Ruoyu Qiu <qiuruoyu@xiaomi.com> Co-authored-by: Ruoyu Qiu <qiuruoyu@xiaomi.com>
2025-09-17[AMDGPU] Add gfx1251 subtarget (#159430)Stanislav Mekhanoshin1-0/+1
2025-09-12[DirectX] Updating Root Signature YAML representation to use Enums instead ↵joaosaffran2-43/+107
of uint (#154827) This PR is updating Root Signature YAML to use enums, this is a required change to remove the use of to_underlying from DirectXContainer binary file. Closes: [#150676](https://github.com/llvm/llvm-project/issues/150676)
2025-09-12[Support] Deprecate one form of support::endian::write (NFC) (#156140)Kazu Hirata1-2/+2
We have two forms of write: template <typename value_type, std::size_t alignment = unaligned> inline void write(void *memory, value_type value, endianness endian) template <typename value_type, endianness endian, std::size_t alignment> inline void write(void *memory, value_type value) The difference is that endian is a function parameter in the former but a template parameter in the latter. This patch streamlines the code by migrating the use of the latter to the former while deprecating the latter. I'm planning to do the same for byte_swap and read in follow-up patches to keep this patch simple and small.
2025-09-11[DirectX] Removing dxbc StaticSampler from mcbxdc (#154631)joaosaffran1-8/+18
MC Static Samplers Representation currently depends on Object structures. This PR removes that dependency and in order to facilitate removing to_underlying usage in follow-up PRs.
2025-09-10[DirectX] Removing dxbc DescriptorRange from mcbxdc (#154629)joaosaffran1-3/+4
MC Descriptor Range Representation currently depend on Object structures. This PR removes that dependency and in order to facilitate removing to_underlying usage in follow-up PRs.
2025-08-29[DirectX] Removing dxbc RootSignature and RootDescriptor from mcbxdc (#154585)joaosaffran1-2/+2
2025-08-27[DirectX][ObectYAML] Make `RootParameterOffset` and `StaticSamplersOffset` ↵Finn Plummer2-8/+30
behaviour consistent (#155521) This pr fixes some inconsistencies in behaviour of how we handle `StaticSamplersOffset` with respect to DXC and `RootParameterOffset`. Namely: 1. Make codegen of `RTS0` always compute the `StaticSamplersOffset` regardless if there are any `StaticSampler`s. This is to be consistent and produce an identical `DXContainer` as DXC. 2. Make the `StaticSamplersOffset` and `RootParametersOffset` optional parameters in the yaml description. This means it will be used when it is specified (which was not necassarily the case before). 3. Enforce that the provided `StaticSamplersOffset` and `RootParametersOffset` in a yaml description match the computed value. For more context see: https://github.com/llvm/llvm-project/issues/155299. Description of existing test updates updates: - `CodeGen/DirectX/ContainerData`: Updated to codegen computed values (previously unspecified) - `llvm-objcopy/DXContainer`: Updated to `yaml2obj` computed values (previously unspecified) - `ObjectYAML/DXContainer`: Updated to `yaml2obj` computed values (previously incorrect) - `ObjectYAML/DXContainerYAMLTest`: Updated to `yaml2obj` computed values (previously incorrect) See newly added tests for testing of optional parameter functionality and `StaticSamplersOffset` computation. Resolves: https://github.com/llvm/llvm-project/issues/155299
2025-08-25[DirectX] Refactor RootSignature Backend to remove `to_underlying` from Root ↵joaosaffran1-16/+18
Parameter Header (#154249) This patch is refactoring Root Parameter Header in DX Container backend to remove the usage of `to_underlying`. This requires some changes: first, MC Root Signature should not depend on Object/DXContainer.h; Second, we need to assume data to be valid in scenarios where it was originally not expected, this made some tests be removed.
2025-08-25[SHT_LLVM_BB_ADDR_MAP] Change the callsite feature to emit end of callsites. ↵Rahman Lavaee2-9/+9
(#155041) This PR simply moves the callsite anchors from the beginning of callsites to their end. Emitting the end of callsites is more sensible as it allows breaking the basic block into subblocks which end with control transfer instructions.
2025-07-31Reapply "Allow "[[FLAGS=<none>]]" value in the ELF Fileheader Flags field ↵Aakanksha Patil2-2/+6
(#143845)" (#151094) This fixes the issues with 0b054e2 This reverts commit b80ce054206db223ec8c3cd55fad510c97afbc9f.
2025-07-21Revert "Allow "[[FLAGS=<none>]]" value in the ELF Fileheader Flags field ↵Nico Weber1-5/+1
(#143845)" This reverts commit 0b054e21f473e258fe0a886fea908fe8bb867bc8. Breaks many tests, see comments on #143845.
2025-07-21Allow "[[FLAGS=<none>]]" value in the ELF Fileheader Flags field (#143845)Aakanksha Patil1-1/+5
https://github.com/llvm/llvm-project/pull/92066 will be dependent on this change
2025-07-16[elf] Add support for {SHT,PT}_GNU_SFRAME constants (#148803)Pavel Labath1-0/+2
Reference: https://sourceware.org/git/?p=gnu-gabi.git;a=blob;f=program-loading-and-dynamic-linking.txt;h=3357d865720285df2d29c4e8f92de49ddf1beb40;hb=refs/heads/master
2025-07-03[NFC][HLSL][DirectX] Let `HLSLRootSignature` reuse the `dxbc` defined enums ↵Finn Plummer1-24/+25
(#145986) This pr removes the redundancy of having the same enums defined in both the front-end and back-end of handling root signatures. Since there are many more uses of the enum in the front-end of the code, we will adhere to the naming conventions used in the front-end, to minimize the diff. The macros in `DXContainerConstants.def` are also touched-up to be consistent and to have each macro name follow its respective definition in d3d12.h and searchable by name [here](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/). Additionally, the many `getEnumNames` are moved to `DXContainer` from `HLSLRootSignatureUtils` as they we will want them to be exposed publicly anyways. Changes for each enum follow the pattern of a commit that will make the enum definition in `DXContainer` adhere to above listed naming conventions, followed by a commit to actually use that enum in the front-end. Resolves https://github.com/llvm/llvm-project/issues/145815
2025-07-02[SHT_LLVM_BB_ADDR_MAP] Remove support for versions 1 and 0 ↵Rahman Lavaee1-1/+0
(SHT_LLVM_BB_ADDR_MAP_V0). (#146186) Version 2 was added more than two years ago (https://github.com/llvm/llvm-project/commit/6015a045d768feab3bae9ad9c0c81e118df8b04a). So it should be safe to deprecate older versions.
2025-06-24Add support for Windows Secure Hot-Patching (redo) (#145565)sivadeilra1-0/+5
(This is a re-do of #138972, which had a minor warning in `Clang.cpp`.) This PR adds some of the support needed for Windows hot-patching. Windows implements a form of hot-patching. This allows patches to be applied to Windows apps, drivers, and the kernel, without rebooting or restarting any of these components. Hot-patching is a complex technology and requires coordination between the OS, compilers, linkers, and additional tools. This PR adds support to Clang and LLVM for part of the hot-patching process. It enables LLVM to generate the required code changes and to generate CodeView symbols which identify hot-patched functions. The PR provides new command-line arguments to Clang which allow developers to identify the list of functions that need to be hot-patched. This PR also allows LLVM to directly receive the list of functions to be modified, so that language front-ends which have not yet been modified (such as Rust) can still make use of hot-patching. This PR: * Adds a `MarkedForWindowsHotPatching` LLVM function attribute. This attribute indicates that a function should be _hot-patched_. This generates a new CodeView symbol, `S_HOTPATCHFUNC`, which identifies any function that has been hot-patched. This attribute also causes accesses to global variables to be indirected through a `_ref_*` global variable. This allows hot-patched functions to access the correct version of a global variable; the hot-patched code needs to access the variable in the _original_ image, not the patch image. * Adds a `AllowDirectAccessInHotPatchFunction` LLVM attribute. This attribute may be placed on global variable declarations. It indicates that the variable may be safely accessed without the `_ref_*` indirection. * Adds two Clang command-line parameters: `-fms-hotpatch-functions-file` and `-fms-hotpatch-functions-list`. The `-file` flag may point to a text file, which contains a list of functions to be hot-patched (one function name per line). The `-list` flag simply directly identifies functions to be patched, using a comma-separated list. These two command-line parameters may also be combined; the final set of functions to be hot-patched is the union of the two sets. * Adds similar LLVM command-line parameters: `--ms-hotpatch-functions-file` and `--ms-hotpatch-functions-list`. * Adds integration tests for both LLVM and Clang. * Adds support for dumping the new `S_HOTPATCHFUNC` CodeView symbol. Although the flags are redundant between Clang and LLVM, this allows additional languages (such as Rust) to take advantage of hot-patching support before they have been modified to generate the required attributes. Credit to @dpaoliello, who wrote the original form of this patch.
2025-06-24[DirectX] Fix order of `v2::DescriptorRange` (#145555)joaosaffran1-30/+51
As pointed in #145438, the order of elements in `v2::DescriptorRange` is wrong according to the root signature file format. This changes the order and updates the code and test to continue to pass. Closes: #145438 --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-06-24Revert "Add support for Windows Secure Hot-Patching" (#145553)Qinkun Bao1-5/+0
Reverts llvm/llvm-project#138972
2025-06-24Add support for Windows Secure Hot-Patching (#138972)sivadeilra1-0/+5
This PR adds some of the support needed for Windows hot-patching. Windows implements a form of hot-patching. This allows patches to be applied to Windows apps, drivers, and the kernel, without rebooting or restarting any of these components. Hot-patching is a complex technology and requires coordination between the OS, compilers, linkers, and additional tools. This PR adds support to Clang and LLVM for part of the hot-patching process. It enables LLVM to generate the required code changes and to generate CodeView symbols which identify hot-patched functions. The PR provides new command-line arguments to Clang which allow developers to identify the list of functions that need to be hot-patched. This PR also allows LLVM to directly receive the list of functions to be modified, so that language front-ends which have not yet been modified (such as Rust) can still make use of hot-patching. This PR: * Adds a `MarkedForWindowsHotPatching` LLVM function attribute. This attribute indicates that a function should be _hot-patched_. This generates a new CodeView symbol, `S_HOTPATCHFUNC`, which identifies any function that has been hot-patched. This attribute also causes accesses to global variables to be indirected through a `_ref_*` global variable. This allows hot-patched functions to access the correct version of a global variable; the hot-patched code needs to access the variable in the _original_ image, not the patch image. * Adds a `AllowDirectAccessInHotPatchFunction` LLVM attribute. This attribute may be placed on global variable declarations. It indicates that the variable may be safely accessed without the `_ref_*` indirection. * Adds two Clang command-line parameters: `-fms-hotpatch-functions-file` and `-fms-hotpatch-functions-list`. The `-file` flag may point to a text file, which contains a list of functions to be hot-patched (one function name per line). The `-list` flag simply directly identifies functions to be patched, using a comma-separated list. These two command-line parameters may also be combined; the final set of functions to be hot-patched is the union of the two sets. * Adds similar LLVM command-line parameters: `--ms-hotpatch-functions-file` and `--ms-hotpatch-functions-list`. * Adds integration tests for both LLVM and Clang. * Adds support for dumping the new `S_HOTPATCHFUNC` CodeView symbol. Although the flags are redundant between Clang and LLVM, this allows additional languages (such as Rust) to take advantage of hot-patching support before they have been modified to generate the required attributes. Credit to @dpaoliello, who wrote the original form of this patch.
2025-06-23[SHT_LLVM_BB_ADDR_MAP] Encode and decode callsite offsets in a ↵Rahman Lavaee2-1/+13
newly-introduced SHT_LLVM_BB_ADDR_MAP version. (#144426) Recently, we have been looking at some optimizations targeting individual calls. In particular, we plan to extend the address mapping technique to map to individual callsites. For example, in this piece of code for a basic blocks: ``` <BB>: 1200: lea 0x1(%rcx), %rdx 1204: callq foo 1209: cmpq 0x10, %rdx 120d: ja L1 ``` We want to emit 0x9 as the call site offset for `callq foo` (the offset from the block entry to right after the call), so that we know if a sampled address is before the call or after. This PR implements the decode/encode/emit capability. The Codegen change will be implemented in a later PR.
2025-06-19[AMDGPU] Initial support for gfx1250 target. (#144965)Stanislav Mekhanoshin1-0/+1
This is just a stub for now.
2025-06-06[SystemZ][z/OS] add back headers needed for strnlen, autoconversionAbhina Sreeskantharajan2-0/+2
2025-06-04[llvm] Remove unused includes (NFC) (#142733)Kazu Hirata2-2/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-05-29[DirectX] Adding support for static samplers in yaml2obj/obj2yaml (#139963)joaosaffran2-0/+58
- Adds support for static samplers ins dxcontainer binary format. - Adds writing logic to mcdxbc - adds reading logic to Object - adds tests Closes: [126636](https://github.com/llvm/llvm-project/issues/126636) --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-05-29[DirectX] adding support to read/write descriptor table data using ↵joaosaffran2-0/+98
obj2yaml/yaml2obj (#138315) Closes: https://github.com/orgs/llvm/projects/4/views/22?sliceBy%5Bvalue%5D=joaosaffran&pane=issue&itemId=97332852&issue=llvm%7Cllvm-project%7C126635 --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-05-27[NFC] Updating RTS0 namespace to contain all elements related to it's ↵joaosaffran2-4/+5
representation (#141173) As requested in a previous PR, this change moves all structs related to RTS0 to RTS0 namespace. --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-05-27[NFC] Refactoring DXContainerYaml Root Parameter representation (#138318)joaosaffran2-44/+67
This PR removes the union usage from `DXContainerYaml` Root Parameters representation, it uses variant instead. closes: [#139585](https://github.com/llvm/llvm-project/issues/139585) --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-05-15[NFC] Refactoring MCDXBC to support out of order storage of root parameters ↵joaosaffran1-12/+18
(#137284) This PR refactors mcdxbc data structure for root signatures to support out of order storage of in memory root signature data. closes: #139585 --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-05-08[DirectX] Adding support for Root Descriptors in obj2yaml/yaml2obj (#137259)joaosaffran2-4/+51
closes: [126634](https://github.com/llvm/llvm-project/issues/126634) --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-05-07[NFC][Support] Add llvm::uninitialized_copy (#138174)Rahul Joshi1-1/+1
Add `llvm::uninitialized_copy` that accepts a range instead of start/end iterator for the source of the copy.
2025-05-05[SPARC] Add llvm-readobj support, update ELF reloc types and dynamic tags. ↵Alex Rønne Petersen1-0/+10
(#137916) Values sourced from binutils.
2025-04-26[llvm] Use llvm::copy (NFC) (#137470)Kazu Hirata1-2/+2
2025-04-16[DirectX] adding support in obj2yaml and yaml2obj to root constants (#127840)joaosaffran2-10/+93
Adding support for Root Constant in MC, Object and obj2yaml and yaml2obj, this PR adds: - new structures to dxbc definition. - serialize and desirialize logic from dxcontainer to yaml - tests validating against dxc - adding support to multiple parts. Closes: https://github.com/llvm/llvm-project/issues/126633 --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-03-30[llvm] Use llvm::append_range (NFC) (#133658)Kazu Hirata1-3/+1
2025-03-04[lld][WebAssembly] Support for the custom-page-sizes WebAssembly proposal ↵Nick Fitzgerald1-0/+3
(#128942) This commit adds support for WebAssembly's custom-page-sizes proposal to `wasm-ld`. An overview of the proposal can be found [here](https://github.com/WebAssembly/custom-page-sizes/blob/main/proposals/custom-page-sizes/Overview.md). In a sentence, it allows customizing a Wasm memory's page size, enabling Wasm to target environments with less than 64KiB of memory (the default Wasm page size) available for Wasm memories. This commit contains the following: * Adds a `--page-size=N` CLI flag to `wasm-ld` for configuring the linked Wasm binary's linear memory's page size. * When the page size is configured to a non-default value, then the final Wasm binary will use the encodings defined in the custom-page-sizes proposal to declare the linear memory's page size. * Defines a `__wasm_first_page_end` symbol, whose address points to the first page in the Wasm linear memory, a.k.a. is the Wasm memory's page size. This allows writing code that is compatible with any page size, and doesn't require re-compiling its object code. At the same time, because it just lowers to a constant rather than a memory access or something, it enables link-time optimization. * Adds tests for these new features. r? @sbc100 cc @sunfishcode
2025-02-24[object][WebAssembly] Add support for RUNTIME_PATH to yaml2obj and obj2yaml ↵Hood Chatham2-0/+9
(#126080) This is the first step of adding RPATH support for wasm. See corresponding update to the WebAssembly/tool-conventions repo on dynamic linking: https://github.com/WebAssembly/tool-conventions/pull/246
2025-02-20[ObjectYAML] Avoid repeated hash lookups (NFC) (#127958)Kazu Hirata1-12/+14
2025-02-19[AMDGPU] Replace gfx940 and gfx941 with gfx942 in llvm (#126763)Fabian Ritter1-2/+0
gfx940 and gfx941 are no longer supported. This is one of a series of PRs to remove them from the code base. This PR removes all non-documentation occurrences of gfx940/gfx941 from the llvm directory, and the remaining occurrences in clang. Documentation changes will follow. For SWDEV-512631
2025-02-14[AArch64] Add support for SHF_AARCH64_PURECODE ELF section flag (1/3) (#125687)Csanád Hajdú1-0/+3
Add support for the new SHF_AARCH64_PURECODE ELF section flag: https://github.com/ARM-software/abi-aa/pull/304 The general implementation follows the existing one for ARM targets. Generating object files with the `SHF_AARCH64_PURECODE` flag set is enabled by the `+execute-only` target feature. Related PRs: * Clang: https://github.com/llvm/llvm-project/pull/125688 * LLD: https://github.com/llvm/llvm-project/pull/125689
2025-02-13[DXIL] Add support for root signature flag element in DXContainer (#123147)joaosaffran2-13/+13
Adding support for Root Signature Flags Element extraction and writing to DXContainer. - Adding an analysis to deal with RootSignature metadata definition - Adding validation for Flag - writing RootSignature blob into DXIL Closes: [126632](https://github.com/llvm/llvm-project/issues/126632) --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-02-07[DXIL] Adding support to RootSignatureFlags in obj2yaml (#122396)joaosaffran2-0/+48
This PR adds: - `RootSignatureFlags` extraction from DXContainer using `obj2yaml` This PR is part of: #121493 --------- Co-authored-by: joaosaffran <joao.saffran@microsoft.com>
2025-02-07[ObjectYAML] Avoid repeated hash lookups (NFC) (#126187)Kazu Hirata1-7/+4
2025-01-23[yaml2obj] Don't use uninitialized Type (#123274)Vitaly Buka1-1/+1
Alternative to #123137 With -DMACHINE=EM_NONE, machine specific sections, like SHT_ARM_EXIDX, will fall to parse and set `Type`. This triggers msan on ``` yaml2obj llvm-project/llvm/test/tools/yaml2obj/ELF/mips-abi-flags.yaml -DMACHINE=EM_NONE ```
2025-01-23[YAML] Don't validate `Fill::Size` after error (#123280)Vitaly Buka2-2/+7
Size is required, so we don't know if it's in uninitialized state after the previous error. Triggers msan on llvm/test/tools/yaml2obj/ELF/custom-fill.yaml NOSIZE test. We have `Fill` Section with Pattern, but no size. Before the fix it produced error: ``` YAML:169:5: error: missing required key 'Size' - Type: Fill ^ YAML:169:5: error: "Size" can't be 0 when "Pattern" is not empty - Type: Fill ``` The same applies to `MachOYAML::Section` fields `content` and `size`. However `MachOYAML::Section` matches size first, so on error, content is not set anyway. Added error checking just in case.
2025-01-21[ObjectYAML][NFC] Simplify ELFState<ELFT>::initProgramHeaders() (#123703)Igor Kudrin1-4/+0
This removes unused variables and dead code in the method.