summaryrefslogtreecommitdiff
path: root/llvm/lib/ObjectYAML/ELFYAML.cpp
AgeCommit message (Collapse)Author
2025-11-08[ObjectYAML] Remove extraneous .c_str() (NFC) (#167189)Kazu Hirata
maskedBitSetCase takes StringRef, so we can "implicitly cast" std::string to StringRef. Identified with readability-redundant-string-cstr.
2025-11-05[ObjectYAML] Remove redundant declarations (NFC) (#166508)Kazu Hirata
In C++17, static constexpr members are implicitly inline, so they no longer require an out-of-line definition. Identified with readability-redundant-declaration.
2025-10-30[SHT_LLVM_BB_ADDR] Implement ELF and YAML support for Propeller CFG data in ↵Rahman Lavaee
PGO analysis map. (#164914) This PR implements the ELF support for PostLink CFG in PGO analysis map as discussed in [RFC](https://discourse.llvm.org/t/rfc-extending-the-pgo-analysis-map-with-propeller-cfg-frequencies/88617/2). A later PR will implement the Codegen Support.
2025-10-22[llvm] Update call graph ELF section type. (#164461)Prabhu Rajasekaran
Make call graph section to have a dedicated type instead of the generic progbits type.
2025-10-16[Hexagon] Define V91 ISA and Processor versions in ELF flags (#163631)quic-areg
These versions are not supported by upstream LLVM but are needed to add support in the eld linker.
2025-10-16[Hexagon] Add missing ELFYAML ISA/processor versions (#163824)quic-areg
2025-10-14Adding Matching and Inference Functionality to Propeller (#160706)wdx727
We have optimized the implementation of introducing the "matching and inference" technique into Propeller. In this new implementation, we have made every effort to avoid introducing new compilation parameters while ensuring compatibility with Propeller's current usage. Instead of creating a new profile format, we reused the existing one employed by Propeller. This new implementation is fully compatible with Propeller's current usage patterns and reduces the amount of code changes. For detailed information, please refer to the following RFC: https://discourse.llvm.org/t/rfc-adding-matching-and-inference-functionality-to-propeller/86238. We plan to submit the relevant changes in several pull requests (PRs). The current one is the first PR, which adds the basic block hash to the SHT_LLVM_BB_ADDR_MAP section. co-authors: lifengxiang1025 <lifengxiang@kuaishou.com>; zcfh <wuminghui03@kuaishou.com> Co-authored-by: lifengxiang1025 <lifengxiang@kuaishou.com> Co-authored-by: zcfh <wuminghui03@kuaishou.com> Co-authored-by: Rahman Lavaee <rahmanl@google.com>
2025-09-22[BinaryFormat][ELF] Rename machine type INTEL205 to INTELGT (#159791)Nick Sarnie
`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-17[AMDGPU] Add gfx1251 subtarget (#159430)Stanislav Mekhanoshin
2025-08-25[SHT_LLVM_BB_ADDR_MAP] Change the callsite feature to emit end of callsites. ↵Rahman Lavaee
(#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 Patil
(#143845)" (#151094) This fixes the issues with 0b054e2 This reverts commit b80ce054206db223ec8c3cd55fad510c97afbc9f.
2025-07-16[elf] Add support for {SHT,PT}_GNU_SFRAME constants (#148803)Pavel Labath
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-02[SHT_LLVM_BB_ADDR_MAP] Remove support for versions 1 and 0 ↵Rahman Lavaee
(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-23[SHT_LLVM_BB_ADDR_MAP] Encode and decode callsite offsets in a ↵Rahman Lavaee
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 Mekhanoshin
This is just a stub for now.
2025-05-05[SPARC] Add llvm-readobj support, update ELF reloc types and dynamic tags. ↵Alex Rønne Petersen
(#137916) Values sourced from binutils.
2025-02-19[AMDGPU] Replace gfx940 and gfx941 with gfx942 in llvm (#126763)Fabian Ritter
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ú
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-01-23[yaml2obj] Don't use uninitialized Type (#123274)Vitaly Buka
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 Buka
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-16Revert "[YAML] Init local var not set by some branches" (#123238)Vitaly Buka
Reverts llvm/llvm-project#123137 It's a bug according to https://github.com/llvm/llvm-project/pull/123137#pullrequestreview-2555328813
2025-01-15[YAML] Init local var not set by some branches (#123137)Vitaly Buka
It will not be set if: 1. `(TypeStr.starts_with("SHT_") || isInteger(TypeStr)) == false`: here we want go to switch default. 2. `IO.mapRequired("Type", Type);` fail parsing. It sets error internally, so probably not important what happen next, so it's go to the switch
2024-12-20[Hexagon] Add V75 support to compiler and assembler (#120773)Ikhlas Ajbar
This patch introduces support for the Hexagon V75 architecture. It includes instruction formats, definitions, encodings, scheduling classes, and builtins/intrinsics.
2024-12-11[llvm][llvm-readobj] Add NT_ARM_GCS Linux core note type (#117545)David Spickett
The ARM Guarded Control Stack extension (GCS) is similar to existing shadow stack extensions for other architectures. The core note will include which features of GCS are enabled, which have been locked in their current state, and the stack pointer of the shadow stack. Note that 0x40f is NT_ARM_POE, FPMR is supported by LLDB and GCS will be soon, POE is not at this time. So NT_ARM_POE will be added when that work starts. See https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h.
2024-11-18AMDGPU: Add gfx950 subtarget definitions (#116307)Matt Arsenault
Mostly a stub, but adds some baseline tests and tests for removed instructions.
2024-11-12[AMDGPU] Introduce a new generic target `gfx9-4-generic` (#115190)Shilei Tian
This patch introduces a new generic target, `gfx9-4-generic`. Since it doesn’t support FP8 and XF32-related instructions, the patch includes several code reorganizations to accommodate these changes.
2024-11-08[ObjectYAML][ELF] Allow verdaux entry offset to be user-definedAntonio Frighetto
2024-10-23[AMDGPU] Add a new target for gfx1153 (#113138)Carl Ritson
2024-08-15[SPARC][Utilities] Add names for SPARC ELF flags in LLVM binary utilities ↵Koakuma
(#102843) This allows us to use and print readable names in LLVM binary utilities.
2024-08-12[llvm][llvm-readobj] Add NT_ARM_FPMR corefile note type (#102594)David Spickett
This contains the fpmr register which was added in Armv9.5-a. This register mainly contains controls for fp8 formats. It was added to the Linux Kernel in https://github.com/torvalds/linux/commit/4035c22ef7d43a6c00d6a6584c60e902b95b46af.
2024-07-01[MC,llvm-readobj,yaml2obj] Support CREL relocation formatFangrui Song
CREL is a compact relocation format for the ELF object file format. This patch adds integrated assembler support (using the RELA form) available with `llvm-mc -filetype=obj -crel a.s -o a.o`. A dependent patch will add `clang -c -Wa,--crel,--allow-experimental-crel`. Also add llvm-readobj support (for both REL and RELA forms) to facilitate testing the assembler. Additionally, yaml2obj gains support for the RELA form to aid testing with llvm-readobj. We temporarily assign the section type code 0x40000020 from the generic range to `SHT_CREL`. We avoided using `SHT_LLVM_` or `SHT_GNU_` to avoid code churn and maintain broader applicability for interested psABIs. Similarly, `DT_CREL` is temporarily 0x40000026. LLVM will change the code and break compatibility. This is not an issue if all relocatable files using CREL are regenerated (aka no prebuilt relocatable files). Link: https://discourse.llvm.org/t/rfc-crel-a-compact-relocation-format-for-elf/77600 Pull Request: https://github.com/llvm/llvm-project/pull/91280
2024-06-06[AMDGPU] Add a new target gfx1152 (#94534)Shilei Tian
2024-05-31AMDGPU: Add gfx12-generic target (#93875)Konstantin Zhuravlyov
2024-03-19[Hexagon] ELF attributes for Hexagon (#85359)quic-areg
Defines a subset of attributes and emits them to a section called .hexagon.attributes. The current attributes recorded are the attributes needed by llvm-objdump to automatically determine target features and eliminate the need to manually pass features.
2024-02-21[ARM,MC] Support FDPIC relocationsFangrui Song
Linux kernel fs/binfmt_elf_fdpic.c supports FDPIC for MMU-less systems. GCC/binutils/qemu support FDPIC ABI for ARM (https://github.com/mickael-guene/fdpic_doc). _ARM FDPIC Toolchain and ABI_ provides a summary. This patch implements FDPIC relocations to the integrated assembler. There are 6 static relocations and 2 dynamic relocations, with R_ARM_FUNCDESC as both static and dynamic. gas requires `--fdpic` to assemble data relocations like `.word f(FUNCDESC)`. This patch adds `MCTargetOptions::FDPIC` and reports an error if FDPIC is not set. Pull Request: https://github.com/llvm/llvm-project/pull/82187
2024-02-12[AMDGPU] Introduce GFX9/10.1/10.3/11 Generic Targets (#76955)Pierre van Houtryve
These generic targets include multiple GPUs and will, in the future, provide a way to build once and run on multiple GPU, at the cost of less optimization opportunities. Note that this is just doing the compiler side of things, device libs an runtimes/loader/etc. don't know about these targets yet, so none of them actually work in practice right now. This is just the initial commit to make LLVM aware of them. This contains the documentation changes for both this change and #76954 as well.
2024-02-05[AMDGPU] Introduce Code Object V6 (#76954)Pierre van Houtryve
Introduce Code Object V6 in Clang, LLD, Flang and LLVM. This is the same as V5 except a new "generic version" flag can be present in EFLAGS. This is related to new generic targets that'll be added in a follow-up patch. It's also likely V6 will have new changes (possibly new metadata entries) added later. Docs change are part of the follow-up patch #76955
2024-02-01[SHT_LLVM_BB_ADDR_MAP] Allow basic-block-sections and labels be used ↵Rahman Lavaee
together by decoupling the handling of the two features. (#74128) Today `-split-machine-functions` and `-fbasic-block-sections={all,list}` cannot be combined with `-basic-block-sections=labels` (the labels option will be ignored). The inconsistency comes from the way basic block address map -- the underlying mechanism for basic block labels -- encodes basic block addresses (https://lists.llvm.org/pipermail/llvm-dev/2020-July/143512.html). Specifically, basic block offsets are computed relative to the function begin symbol. This relies on functions being contiguous which is not the case for MFS and basic block section binaries. This means Propeller cannot use binary profiles collected from these binaries, which limits the applicability of Propeller for iterative optimization. To make the `SHT_LLVM_BB_ADDR_MAP` feature work with basic block section binaries, we propose modifying the encoding of this section as follows. First let us review the current encoding which emits the address of each function and its number of basic blocks, followed by basic block entries for each basic block. | | | |--|--| | Address of the function | Function Address | | Number of basic blocks in this function | NumBlocks | | BB entry 1 | BB entry 2 | ... | BB entry #NumBlocks To make this work for basic block sections, we treat each basic block section similar to a function, except that basic block sections of the same function must be encapsulated in the same structure so we can map all of them to their single function. We modify the encoding to first emit the number of basic block sections (BB ranges) in the function. Then we emit the address map of each basic block section section as before: the base address of the section, its number of blocks, and BB entries for its basic block. The first section in the BB address map is always the function entry section. | | | |--|--| | Number of sections for this function | NumBBRanges | | Section 1 begin address | BaseAddress[1] | | Number of basic blocks in section 1 | NumBlocks[1] | | BB entries for Section 1 |..................| | Section #NumBBRanges begin address | BaseAddress[NumBBRanges] | | Number of basic blocks in section #NumBBRanges | NumBlocks[NumBBRanges] | | BB entries for Section #NumBBRanges The encoding of basic block entries remains as before with the minor change that each basic block offset is now computed relative to the begin symbol of its containing BB section. This patch adds a new boolean codegen option `-basic-block-address-map`. Correspondingly, the front-end flag `-fbasic-block-address-map` and LLD flag `--lto-basic-block-address-map` are introduced. Analogously, we add a new TargetOption field `BBAddrMap`. This means BB address maps are either generated for all functions in the compiling unit, or for none (depending on `TargetOptions::BBAddrMap`). This patch keeps the functionality of the old `-fbasic-block-sections=labels` option but does not remove it. A subsequent patch will remove the obsolete option. We refactor the `BasicBlockSections` pass by separating the BB address map and BB sections handing to their own functions (named `handleBBAddrMap` and `handleBBSections`). `handleBBSections` renumbers basic blocks and places them in their assigned sections. `handleBBAddrMap` is invoked after `handleBBSections` (if requested) and only renumbers the blocks. - New tests added: - Two tests basic-block-address-map-with-basic-block-sections.ll and basic-block-address-map-with-mfs.ll to exercise the combination of `-basic-block-address-map` with `-basic-block-sections=list` and '-split-machine-functions`. - A driver sanity test for the `-fbasic-block-address-map` option (basic-block-address-map.c). - An LLD test for testing the `--lto-basic-block-address-map` option. This reuses the LLVM IR from `lld/test/ELF/lto/basic-block-sections.ll`. - Renamed and modified the two existing codegen tests for basic block address map (`basic-block-sections-labels-functions-sections.ll` and `basic-block-sections-labels.ll`) - Removed `SHT_LLVM_BB_ADDR_MAP_V0` tests. Full deprecation of `SHT_LLVM_BB_ADDR_MAP_V0` and `SHT_LLVM_BB_ADDR_MAP` version less than 2 will happen in a separate PR in a few months.
2023-12-12[SHT_LLVM_BB_ADDR_MAP] Implements PGOAnalysisMap in Object and ObjectYAML ↵Micah Weston
with tests. Reviewed in PR (#71750). A part of [RFC - PGO Accuracy Metrics: Emitting and Evaluating Branch and Block Analysis](https://discourse.llvm.org/t/rfc-pgo-accuracy-metrics-emitting-and-evaluating-branch-and-block-analysis/73902). This PR adds the PGOAnalysisMap data structure and implements encoding and decoding through Object and ObjectYAML along with associated tests. When emitted into the bb-addr-map section, each function is followed by the associated pgo-analysis-map for that function. The emitting of each analysis in the map is controlled by a bit in the bb-addr-map feature byte. All existing bb-addr-map code can ignore the pgo-analysis-map if the caller does not request the data.
2023-12-11[llvm] Use StringRef::{starts,ends}_with (NFC) (#74956)Kazu Hirata
This patch replaces uses of StringRef::{starts,ends}with with StringRef::{starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. I'm planning to deprecate and eventually remove StringRef::{starts,ends}with.
2023-12-09[llvm-readobj][AArch64][ELF][PAC] Support ELF AUTH constants (#74874)Daniil Kovalev
Reapply llvm/llvm-project#72713 after fixing formatted printing of `uint64_t` values as hex (see failing build here https://lab.llvm.org/buildbot/#/builders/186/builds/13604). This patch adds llvm-readobj support for: - Dynamic `R_AARCH64_AUTH_*` relocations (including RELR compressed AUTH relocations) as described here: https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#auth-variant-dynamic-relocations - `.note.AARCH64-PAUTH-ABI-tag` section as defined here https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#elf-marking
2023-12-08Revert "[llvm-readobj][AArch64][ELF][PAC] Support ELF AUTH constants" (#74816)Daniil Kovalev
Reverts llvm/llvm-project#72713 Buildbot tests fail on clang-armv7-global-isel builder https://lab.llvm.org/buildbot/#/builders/186/builds/13604
2023-12-08[llvm-readobj][AArch64][ELF][PAC] Support ELF AUTH constants (#72713)Daniil Kovalev
This patch adds llvm-readobj support for: - Dynamic R_AARCH64_AUTH_* relocations (including RELR compressed AUTH relocations) as described here: https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#auth-variant-dynamic-relocations - .note.AARCH64-PAUTH-ABI-tag section as defined here https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#elf-marking
2023-11-23[AMDGPU] Define new targets gfx1200 and gfx1201 (#73133)Jay Foad
Define target names and ELF numbers for new GFX12 targets gfx1200 and gfx1201. For now they behave identically to GFX11.
2023-10-20[llvm][llvm-readobj] Add AArch64 Tagged Address note type (#68568)David Spickett
On Linux this contains a single register that determines memory tagging and tagged address ABI settings.
2023-07-17[AMDGPU] Add targets gfx1150 and gfx1151Jay Foad
This is the target definition only. Currently they are treated the same as GFX 11.0.x. Differential Revision: https://reviews.llvm.org/D155429
2023-06-28[Object] Add ELF section type SHT_LLVM_BITCODE for LLVM bitcodeFangrui Song
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-05-10AMDGPU: Add basic gfx942 targetKonstantin Zhuravlyov
Differential Revision: https://reviews.llvm.org/D149983
2023-05-10AMDGPU: Add basic gfx941 targetKonstantin Zhuravlyov
Differential Revision: https://reviews.llvm.org/D149982
2023-04-13[llvm][readobj] Add AArch64 SME and SME2 note typesDavid Spickett
These are used to store new state added by the Scalable Matrix Extension which is documented in https://developer.arm.com/documentation/ddi0616/aa/. The values match those defined by Linux, see: https://github.com/torvalds/linux/blob/e62252bc55b6d4eddc6c2bdbf95a448180d6a08d/include/uapi/linux/elf.h#L435 The ZT register(s) are added by SME2 which is not yet publicly documented but has support in LLVM and Linux already. Also added descriptions for SVE and PAC_MASK notes since those were missing. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D148126