aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/ObjectYAML
AgeCommit message (Collapse)AuthorFilesLines
2024-03-25Add support for PSV EntryFunctionName (#86296)Cooper Partin8-0/+814
This change introduces a version 3 of the PSV data that includes support for the name of the entry function as an offset into StringTable data to a null-terminated utf-8 string. Additional tests were added to ensure that the new value was properly serialized/deserialized from object data. Fixes #80175 --------- Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-03-21Revert "Add support for PSV EntryFunctionName (#84409)" (#86211)Cooper Partin8-814/+0
This reverts commit cde54df39cab3a1d60a3e1862ab341609bee3cc3. Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-03-21Add support for PSV EntryFunctionName (#84409)Cooper Partin8-0/+814
This change introduces a version 3 of the PSV data that includes support for the name of the entry function as an offset into StringTable data to a null-terminated utf-8 string. Additional tests were added to ensure that the new value was properly serialized/deserialized from object data. Fixes #80175 --------- Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2023-10-05[DX] Add support for program signatures (#67346)Chris B1-0/+254
For DirectX, program signatures are encoded into three different binary sections depending on if the signature is for inputs, outputs, or patches. All three signature types use the same data structure encoding so they can share a lot of logic. This patch adds support for reading and writing program signature data as both yaml and binary data. Fixes #57743 and #57744
2023-09-15[DX] Support pipeline state masks (#66425)Chris B20-82/+810
The DXContainer pipeline state information encodes a bunch of mask vectors that are used to track things about the inputs and outputs from each shader. This adds support for reading and writing them throught he YAML test interfaces. The writing logic in MC is extremely primitive and we'll want to revisit the API for that, but since I'm not sure how we'll want to generate the mask bits from DXIL during code generation I didn't want to spend too much time on the API. Fixes #59479
2023-08-16Re-land [DX] Add support for PSV signature elementsChris Bieneman17-96/+240
The pipeline state data captured in the PSV0 section of the DXContainer file encodes signature elements which are read by the runtime to map inputs and outputs from the GPU program. This change adds support for generating and parsing signature elements with testing driven through the ObjectYAML tooling. Reviewed By: bogner Differential Revision: https://reviews.llvm.org/D157671 Initially landed as 8c567e64f808f7a818965c6bc123fedf7db7336f, and reverted in 4d800633b2683304a5431d002d8ffc40a1815520. ../llvm/include/llvm/BinaryFormat/DXContainerConstants.def ../llvm/test/ObjectYAML/DXContainer/PSVv1-amplification.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-compute.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-domain.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-geometry.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv1-vertex.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-amplification.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-compute.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-domain.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-geometry.yaml ../llvm/test/ObjectYAML/DXContainer/PSVv2-vertex.yaml
2023-08-16Revert "[DX] Add support for PSV signature elements"Chris Bieneman17-240/+96
This reverts commit 8c567e64f808f7a818965c6bc123fedf7db7336f.
2023-08-16[DX] Add support for PSV signature elementsChris Bieneman17-96/+240
The pipeline state data captured in the PSV0 section of the DXContainer file encodes signature elements which are read by the runtime to map inputs and outputs from the GPU program. This change adds support for generating and parsing signature elements with testing driven through the ObjectYAML tooling. Reviewed By: bogner Differential Revision: https://reviews.llvm.org/D157671
2023-07-27[WebAssembly][Objcopy] Write output section headers identically to inputsDerek Schuff1-0/+91
Previously when objcopy generated section headers, it padded the LEB that encodes the section size out to 5 bytes, matching the behavior of clang. This is correct, but results in a binary that differs from the input. This can sometimes have undesirable consequences (e.g. breaking source maps). This change makes the object reader remember the size of the LEB encoding in the section header, so that llvm-objcopy can reproduce it exactly. For sections not read from an object file (e.g. that llvm-objcopy is adding itself), pad to 5 bytes. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D155535
2023-07-19[DX] Fix PSV resource serializationChris Bieneman24-0/+48
When writing this initially I missed including the resource stride. This change adds the resources stride to the serialized value. I've also extended the testing and error reporting around parsing PSV information. This adds tests to verify that the reader produces meaningful error messages for malformed DXContainer files, and a test that verifies the resource stride is respected in the reader even if the stride isn't an expected or known value (as would happen if the format changes in the future). This is part of #59479. Reviewed By: bogner, bob80905 Differential Revision: https://reviews.llvm.org/D155143
2023-06-28[Object] Add ELF section type SHT_LLVM_BITCODE for LLVM bitcodeFangrui Song1-1/+14
clang -ffat-lto-objects can use this new ELF section type for the .llvm.lto section for fat LTO support (D146776). Original RFC: https://discourse.llvm.org/t/rfc-ffat-lto-objects-support/63977 Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D153215
2023-02-02[DX] Add support for PSV resource bindingsChris Bieneman24-0/+496
This patch continues implementing DirectX pipeline state validation information by adding support for resource binding metadata. Reviewed By: python3kgae Differential Revision: https://reviews.llvm.org/D143130
2023-02-01[DX] Begin adding support for pipeline stateChris Bieneman24-0/+1268
DirectX shader pipeline state validation information is a fairly complicated to serialize data structure. This patch adds the first bit of support for reading and writing the runtime info structure which comes first in the encoded data. Subsequent patches will flesh out the remaining fields of the data structure. There is no official documentation for the format, but the format is roughly documented in the code comment here: https://github.com/microsoft/DirectXShaderCompiler/blob/main/include/dxc /DxilContainer/DxilPipelineStateValidation.h#L731 Reviewed By: python3kgae Differential Revision: https://reviews.llvm.org/D141649
2022-12-15[MachOYAML] Improve section offset misalignment error messageMichael Buch1-1/+1
Before: ``` wrote too much data somewhere, section offsets don't line up ``` After: ``` wrote too much data somewhere, section offsets in section __debug_str for segment __DWARF don't line up: [cursor=0x581], [fileStart=0x0], [sectionOffset=0x579] ``` Differential Revision: https://reviews.llvm.org/D140116
2022-11-22[MachO] Support exports trie in both LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIEDaniel Rodríguez Troitiño2-0/+204
The exports trie used to be pointed by the information in LC_DYLD_INFO, but when chained fixups are present, the exports trie is pointed by LC_DYLD_EXPORTS_TRIE instead. Modify the Object library to give access to the information pointed by each of the load commands, and to fallback from one into the other when the exports are requested. Modify ObjectYAML to support dumping the export trie when pointed by LC_DYLD_EXPORTS_TRIE and to parse the existence of a export trie also when the load command is present. This is a split of D134250 with improvements on top. Reviewed By: alexander-shaposhnikov Differential Revision: https://reviews.llvm.org/D134571
2022-11-11[ObjectYAML] Basic support for chained fixups.Daniel Rodríguez Troitiño1-0/+227
Add basic binary support for chained fixups. This allows basic tests with chained fixups without trying to create a format for them until the work on the Object library is considered finished. Reviewed By: pete Differential Revision: https://reviews.llvm.org/D134250
2022-10-04[ObjectYAML] Support for basic data in code.Daniel Rodríguez Troitiño1-0/+218
This is a split of D134250. Supports for parsing and dumping the LC_DATA_IN_CODE contents (as binary data). This allows more complete testing of llvm-objdump in D133974. Reviewed By: Higuoxing Differential Revision: https://reviews.llvm.org/D134569
2022-10-04[ObjectYAML][MachO] Encode export trie address as ULEB128, not as SLEB128Daniel Rodríguez Troitiño1-3/+9
The `dumpExportEntry` was dumping everything using signed LEB128, but the format seems to use unsigned LEB128. This can be cross-checked with the implementation in MachOObjectFile.cpp, the implementation in LLD's ExportTrie.cpp, and the implementation in macho2yaml.cpp, which all use ULEB128 functions.. The difference is only apparent when encoding some values with specific bit patterns (bit active in the 7th, 14th, ... bits of the binary). The encoding was not always creating problems in the resulting binaries because if the extra byte was part of the padding, the result of decoding it as ULEB128 is the same as decoding as SLEB128, however, the code of MachOObjectFile.cpp (used by llvm-objdump) checks the buffer decoding position against the reported length, which triggered an error. Modified a test that used an address with this pattern (0x3FA0, the 14th bit is active), to show that a round trip still produces the same results, and added a check using llvm-objdump to use their extra checks to verify this implementation. Reviewed By: pete Differential Revision: https://reviews.llvm.org/D134563
2022-07-14[obj2yaml] Add -o to specify output filenameFangrui Song2-2/+10
-o is very common among tools. yaml2obj supports -o and it surprised me that obj2yaml doesn't support -o. Just add it which doesn't take much code. Differential Revision: https://reviews.llvm.org/D129713
2022-07-07[Object] Add ELF section type for offloading objectsJoseph Huber1-0/+28
Currently we use the `.llvm.offloading` section to store device-side objects inside the host, creating a fat binary. The contents of these sections is currently determined by the name of the section while it should ideally be determined by its type. This patch adds the new `SHT_LLVM_OFFLOADING` section type to the ELF section types. Which should make it easier to identify this specific data format. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D129052
2022-07-01[ObjectYAML] Add offloading binary implementations for obj2yaml and yaml2objJoseph Huber8-0/+179
This patchs adds the necessary code for inspecting or creating offloading binaries using the standing `obj2yaml` and `yaml2obj` features in LLVM. Depends on D127774 Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D127776
2022-03-14[WebAssembly] Second phase of implemented extended const proposalSam Clegg1-0/+42
This change continues to lay the ground work for supporting extended const expressions in the linker. The included test covers object file reading and writing and the YAML representation. Differential Revision: https://reviews.llvm.org/D121349
2022-02-13[test][ObjectYAML][MachO] Fix assertion syntaxKeith Smiley1-1/+1
This wasn't running because of the missing colon
2022-02-13[ObjectYAML][MachO] Add LC_FUNCTION_STARTS supportKeith Smiley1-0/+186
This adds support for encoding and decoding the LC_FUNCTION_STARTS load command payload. Differential Revision: https://reviews.llvm.org/D119205
2021-11-30[ObjectYAML/obj2yaml/yaml2obj][MachO] Support indirect symbol tableVincent Lee1-0/+259
Tools such as `llvm-objdump` or `llvm-readobj` support indirect symbol tables. Here, support it for `obj2yaml` and `yaml2obj`. Reviewed By: jhenderson, drodriguez Differential Revision: https://reviews.llvm.org/D114410
2021-10-05[WebAssembly] Remove WasmTagTypeHeejin Ahn1-8/+2
This removes `WasmTagType`. `WasmTagType` contained an attribute and a signature index: ``` struct WasmTagType { uint8_t Attribute; uint32_t SigIndex; }; ``` Currently the attribute field is not used and reserved for future use, and always 0. And that this class contains `SigIndex` as its property is a little weird in the place, because the tag type's signature index is not an inherent property of a tag but rather a reference to another section that changes after linking. This makes tag handling in the linker also weird that tag-related methods are taking both `WasmTagType` and `WasmSignature` even though `WasmTagType` contains a signature index. This is because the signature index changes in linking so it doesn't have any info at this point. This instead moves `SigIndex` to `struct WasmTag` itself, as we did for `struct WasmFunction` in D111104. In this CL, in lib/MC and lib/Object, this now treats tag types in the same way as function types. Also in YAML, this removes `struct Tag`, because now it only contains the tag index. Also tags set `SigIndex` in `WasmImport` union, as functions do. I think this makes things simpler and makes tag handling more in line with function handling. These two shares similar properties in that both of them have signatures, but they are kind of nominal so having the same signature doesn't mean they are the same element. Also a drive-by fix: the reserved 'attirubute' part's encoding changed from uleb32 to uint8 a while ago. This was fixed in lib/MC and lib/Object but not in YAML. This doesn't change object files because the field's value is always 0 and its encoding is the same for the both encoding. This is effectively NFC; I didn't mark it as such just because it changed YAML test results. Reviewed By: sbc100, tlively Differential Revision: https://reviews.llvm.org/D111086
2021-09-12[WebAssembly] Convert to new "dylink.0" section formatSam Clegg1-2/+2
This format is based on sub-sections (like the "linking" and "name" sections) and is therefore easier to extend going forward. spec change: https://github.com/WebAssembly/tool-conventions/pull/170 binaryen change: https://github.com/WebAssembly/binaryen/pull/4141 wabt change: https://github.com/WebAssembly/wabt/pull/1707 emscripten change: https://github.com/emscripten-core/emscripten/pull/15019 Differential Revision: https://reviews.llvm.org/D109595
2021-07-26[yaml2obj][MachO] Rename PayloadString to ContentFangrui Song5-18/+18
The new name is conciser and matches yaml2obj ELF & DWARF. Reviewed By: #lld-macho, thakis Differential Revision: https://reviews.llvm.org/D106759
2021-06-17[WebAssembly] Rename event to tagHeejin Ahn1-11/+11
We recently decided to change 'event' to 'tag', and 'event section' to 'tag section', out of the rationale that the section contains a generalized tag that references a type, which may be used for something other than exceptions, and the name 'event' can be confusing in the web context. See - https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130 - https://github.com/WebAssembly/exception-handling/pull/161 Reviewed By: tlively Differential Revision: https://reviews.llvm.org/D104423
2021-04-09[lld] Fixed CodeView GuidAdapter::format to handle GUID bytes in the right ↵Alex Orlov1-2/+2
order. This fixes https://bugs.llvm.org/show_bug.cgi?id=41712 bug. Reviewed By: aganea Differential Revision: https://reviews.llvm.org/D99978
2021-03-24[WebAssembly] Rename WasmLimits::Initial to ::Minimum. NFC.Andy Wingo7-22/+22
This patch renames the "Initial" member of WasmLimits to the name used in the spec, "Minimum". In the core WebAssembly specification, the Limits data type has one required "min" member and one optional "max" member, indicating the minimum required size of the corresponding table or memory, and the maximum size, if any. Although the WebAssembly spec does instantiate locally-defined tables and memories with the initial size being equal to the minimum size, it can't impose such a requirement for imports. It doesn't make sense to require an initial size for a memory import, for example. The compiler can only sensibly express the minimum and maximum sizes. See https://github.com/WebAssembly/js-types/blob/master/proposals/js-types/Overview.md#naming-of-size-limits for a related discussion that agrees that the right name of "initial" is "minimum" when querying the type of a table or memory from JavaScript. (Of course it still makes sense for JS to speak in terms of an initial size when it explicitly instantiates memories and tables.) Differential Revision: https://reviews.llvm.org/D99186
2021-03-05[WebAssembly][yaml2obj][obj2yaml] Elem sections for nonzero tablesAndy Wingo1-0/+123
With reference types, tables can have non-zero table numbers. This commit adds support for element sections against these tables. Differential Revision: https://reviews.llvm.org/D97923
2021-02-25Add more historic DWARF vendor extensionsAdrian Prantl1-2/+2
The maintainer of libdwarf kindly provided this patch with a bunch of historic DWARF extensions that are missing from Dwarf.def. This list is helpful to avoid potential conflicts in the user-defined vendor extension space in the future. Patch by David Anderson! [Relanded with an updated test.] Differential Revision: https://reviews.llvm.org/D97242
2021-02-02[yaml2obj][wasm] Support numeric relocation typeFangrui Song1-0/+6
Differential Revision: https://reviews.llvm.org/D95661
2021-01-25[Object][WebAssembly] Update format of error messagesSam Clegg3-3/+3
Error message should start with lowercase in accordance with https://llvm.org/docs/CodingStandards.html#error-and-warning-messages Differential Revision: https://reviews.llvm.org/D95239
2020-11-18Reland "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping ↵Georgii Rymar49-638/+638
Hex8/Hex16/Hex32 types." (https://reviews.llvm.org/D90930). This reverts reverting commit fc40a03323a4b265ccbed34a07e281b13c5e8367 and fixes LLD (MachO/wasm) tests that failed previously.
2020-11-18Revert "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping ↵Georgii Rymar49-638/+638
Hex8/Hex16/Hex32 types." This reverts commit 65fd17c241e22e1671e81efdb683687369c2feb3. It breaks LLD/MachO tests that seems use obj2yaml the check the output.
2020-11-18[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping ↵Georgii Rymar49-638/+638
Hex8/Hex16/Hex32 types. When we produce an YAML output, we also print leading zeroes currently. An output might look like this: ``` - Name: .dynsym Type: SHT_DYNSYM Address: 0x0000000000001000 EntSize: 0x0000000000000018 ``` There are probably no reason to print leading zeroes. It just makes harder to read values. This patch stops printing them. The output becomes like: ``` - Name: .dynsym Type: SHT_DYNSYM Address: 0x1000 EntSize: 0x18 ``` This affects obj2yaml mostly, but also dsymutil and llvm-xray tools output. Differential revision: https://reviews.llvm.org/D90930
2020-11-11[MachO] Allow the LC_IDENT load commandVedant Kumar1-0/+22
xnu coredumps include an LC_IDENT load command. It's helpful to be able to just ignore these. IIUC an interested client can grab the identifier using the MachOObjectFile::load_commands() API. The status quo is that llvm bails out when it finds an LC_IDENT because the command is obsolete (see isLoadCommandObsolete). Differential Revision: https://reviews.llvm.org/D91221
2020-11-08Fix debug_abbrev emitter to only assign table id onceAntónio Afonso1-6/+16
While generating yamls for my tests I noticed that the new debug_abbrev format (with multiple table support) was incorrectly assigning id's to the table because it was generating one per abbrev entry in the table. For instance, the first table would get id 4 when 5 abbrev entries existed in the table. By itself this is not a problem but the corresponding debug_info sections were still referencing id 0. This was introduced here: https://reviews.llvm.org/D83116. Maybe a better fix is to actually correctly calculate the table id when emitting debug info? From a quick glance it seems to me the ID is just being calculated as the distance between the first DWARFAbbreviationDeclarationSet and the one the debug info entry points to, which means it's just its index and not the actual table id that was generated when emitting the debug_abbrev tables. With my fix I guess this is fine but on the diff that introduced this Pavel mentioned that he would like to have some sort of unique id between them but not necessarily +1 increasing, but for that to work we need to actually find the table ID, I guess by going directly to Y.DebugAbbrev but to honest I have no idea how to link the DWARFAbbreviationDeclarationSet and the Y.DebugAbbrev, so I just did this simple fix. I also realized there's barely any tests for MachO so it might useful to invest on that if the tool is being reworked on. Reviewed By: Higuoxing, jhenderson Differential Revision: https://reviews.llvm.org/D87179
2020-10-13[WebAssembly] Added .tabletype to asm and multiple table support in obj filesPaulo Matos3-3/+7
Adds more testing in basic-assembly.s and a new test tables.s. Adds support to yaml reading and writing of tables as well. Differential Revision: https://reviews.llvm.org/D88815
2020-09-23[DWARFYAML][test] Simplify __debug_pubnames/types tests. NFC.Xing GUO1-284/+30
This patch stripped unneeded sections from the test case. Reviewed By: grimar, MaskRay Differential Revision: https://reviews.llvm.org/D88073
2020-09-18[DWARFYAML] Make the include_directories, file_names and opcodes fields of ↵Xing GUO3-4/+0
the line table optional. This patch makes the include_directories, file_names and opcodes fields of the line table optional. This helps us simplify some tests. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D87878
2020-09-18[DWARFYAML][test] Use 'CHECK-NEXT:' to make checkers stricter. NFC.Xing GUO2-60/+60
This patch makes checkers stricter so that we are able to avoid some potential problems earlier. Reviewed By: jhenderson, MaskRay Differential Revision: https://reviews.llvm.org/D87876
2020-09-09[obj2yaml][test] Test generating and dumping a broken debug_ranges section.Xing GUO1-0/+24
This patch tests generating and dumping a broken debug_ranges section. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D87275
2020-09-08[DWARFYAML] Make the debug_ranges section optional.Xing GUO1-0/+45
This patch makes the debug_ranges section optional. When we specify an empty debug_ranges section, yaml2obj only emits the section header. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D87263
2020-09-08[obj2yaml] Stop parsing the debug_str section when it encounters a string ↵Xing GUO1-0/+58
without the null terminator. When obj2yaml encounters a string without the null terminator, it should stop parsing the debug_str section. This patch addresses comments in [D86867](https://reviews.llvm.org/D86867#inline-803291). Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D87261
2020-09-04[MachOYAML] Allow handcrafting custom contents for DWARF sections.Xing GUO2-4/+45
This patch enables users to handcraft custom contents for DWARF sections. If we specify the contents of DWARF sections both in the 'DWARF' entry and the 'content', yaml2obj will emit an error message. In addition, this patch helps remove the restriction that only the content of sections whose segname are __DWARF can be specified in the "DWARF" entry. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D87126
2020-09-01[DWARFYAML] Make the debug_str section optional.Xing GUO1-1/+70
This patch makes the debug_str section optional. When the debug_str section exists but doesn't contain anything, yaml2obj will emit a section header for it. Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D86860
2020-08-21Recommit: [DWARFYAML] Add support for referencing different abbrev tables.Xing GUO3-1/+300
The original commit (7ff0ace96db9164dcde232c36cab6519ea4fce8) was causing build failure and was reverted in 6d242a73264ef1e3e128547f00e0fe2d20d3ada0 ==================== Original Commit Message ==================== This patch adds support for referencing different abbrev tables. We use 'ID' to distinguish abbrev tables and use 'AbbrevTableID' to explicitly assign an abbrev table to compilation units. The syntax is: ``` debug_abbrev: - ID: 0 Table: ... - ID: 1 Table: ... debug_info: - ... AbbrevTableID: 1 ## Reference the second abbrev table. - ... AbbrevTableID: 0 ## Reference the first abbrev table. ``` Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D83116