aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object
AgeCommit message (Collapse)AuthorFilesLines
5 daysFix typo: IsGlobaLinkage -> IsGlobalLinkage in XCOFF (#161960)小钟1-1/+1
Corrects the spelling of 'IsGlobaLinkage' to 'IsGlobalLinkage' in XCOFF-related code, comments, and tests across the codebase.
7 daysFix typo in comment: 'unit64_t' to 'uint64_t' (#162869)小钟1-2/+2
Corrects a typo in comments within XCOFFObjectFile.cpp, changing 'unit64_t' to the correct type 'uint64_t' for clarity.
11 daysFix compress/decompress in LLVM Offloading API (#150064)David Salinas1-225/+357
Co-authored-by: dsalinas_amdeng <david.salinas@amd.com>
13 daysRevert "Reapply [MachO] Move getArchTriple impl... with fixes. (#161949)"Lang Hames2-1/+158
This reverts commit 54012102c4a8e8bba9b3b27291dab126e3521544 while I further investigate bot failures. Apparently adding a dependence on BinaryFormat to Object was insufficient to fix the original linker issues.
13 daysReapply [MachO] Move getArchTriple implementation..." with fixes. (#161949)Lang Hames2-158/+1
This reapplies cd32b9b6c3b, which was reverted in 25e02a43fe6 due to bot failures. The failures all appear to be link errors due to the Object library not depending on BinaryFormat. This commit adds the missing dependence.
13 daysRevert "[MachO] Move getArchTriple implementation into BinaryFormat. (#161468)"Lang Hames1-0/+158
Reverts commit cd32b9b6c3b while I investigate some bot failures, e.g. https://lab.llvm.org/buildbot/#/builders/10/builds/14784.
13 days[MachO] Move getArchTriple implementation into BinaryFormat. (#161468)Lang Hames1-158/+0
There's nothing ObjectFile specific about getArchTriple, so move it into the BinaryFormat library so that clients can use it without taking a dependence on libObject. MachOObjectFile::getArchTriple is updated to call through to the moved implementation.
2025-10-03[llvm][ELF]Add Shdr check for getBuildID (#126537)Ruoyu Qiu1-6/+20
Add Section Header check for getBuildID, fix crash with invalid Program Header. Fixes: #126418 --------- Signed-off-by: Ruoyu Qiu <cabbaken@outlook.com> Signed-off-by: Ruoyu Qiu <qiuruoyu@xiaomi.com> Co-authored-by: Ruoyu Qiu <qiuruoyu@xiaomi.com> Co-authored-by: James Henderson <James.Henderson@sony.com>
2025-10-01Revert "Revert "Fix memory leak in Offloading API" (#161465)" (#161573)David Salinas1-2/+3
This reverts commit d392563433316e310edacf35a40fb2f9aa477acc.
2025-09-30Revert "Fix memory leak in Offloading API" (#161465)ronlieb1-3/+2
Reverts llvm/llvm-project#161430
2025-09-30Fix memory leak in Offloading API (#161430)David Salinas1-2/+3
Fix or the failing Sanitizer buildbots from PR: https://github.com/llvm/llvm-project/pull/143342
2025-09-29Add --offoading option to llvm-readobj (#143342)David Salinas1-9/+9
Utilize new extensions to LLVM Offloading API to handle offloading fatbin Bundles. The tool will output a list of available offload bundles using URI syntax. --------- Co-authored-by: dsalinas_amdeng <david.salinas@amd.com>
2025-09-28[Object][Archive] Recompute headers and symbol map when switching from COFF ↵Jacek Caban1-2/+18
to GNU64 (#160606) COFF format has no 64-bit version, so we use GNU64 instead. Since this changes the headers, we need to recalculate everything. Fixes #160112.
2025-09-26[DirectX] Updating DXContainer logic to read version 1.2 of static samplers ↵joaosaffran1-4/+7
(#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.
2025-09-20[Object] Add a missing space to a diagnostic (#159826)Nico Weber1-1/+1
Follow-up to https://reviews.llvm.org/D46527
2025-09-19Revert "[ELF][LLDB] Add an nvsass triple (#159459)" (#159879)Joseph Huber2-3/+3
Summary: This patch has broken the `libc` build bot. I could work around that but the changes seem unnecessary. This reverts commit 9ba844eb3a21d461c3adc7add7691a076c6992fc.
2025-09-19[ELF][LLDB] Add an nvsass triple (#159459)Walter Erquinigo2-3/+3
When handling CUDA ELF files via objdump or LLDB, the ELF parser in LLVM needs to distinguish if an ELF file is sass or not, which requires a triple for sass to exist in llvm. This patch includes all the necessary changes for LLDB and objdump to correctly identify these files with the correct triple.
2025-09-17[AMDGPU] Add gfx1251 subtarget (#159430)Stanislav Mekhanoshin1-0/+2
2025-09-17[LLVM] Fix offload and update CUDA ABI for all SM values (#159354)Joseph Huber1-1/+7
Summary: Turns out the new CUDA ABI now applies retroactively to all the other SMs if you upgrade to CUDA 13.0. This patch changes the scheme, keeping all the SM flags consistent but using an offset. Fixes: https://github.com/llvm/llvm-project/issues/159088
2025-09-17[llvm] Validate Parent object before dereference (#157460)Daniel Kuts1-3/+1
Fixes #157449
2025-09-08MC: Add Triple overloads for more MC constructors (#157321)Matt Arsenault1-4/+3
Avoids more Triple->string->Triple round trip. This is a continuation of f137c3d592e96330e450a8fd63ef7e8877fc1908
2025-08-25[SHT_LLVM_BB_ADDR_MAP] Change the callsite feature to emit end of callsites. ↵Rahman Lavaee1-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-08-23RuntimeLibcalls: Add entries for stackprotector globals (#154930)Matt Arsenault1-15/+2
Add entries for_stack_chk_guard, __ssp_canary_word, __security_cookie, and __guard_local. As far as I can tell these are all just different names for the same shaped functionality on different systems. These aren't really functions, but special global variable names. They should probably be treated the same way; all the same contexts that need to know about emittable function names also need to know about this. This avoids a special case check in IRSymtab. This isn't a complete change, there's a lot more cleanup which should be done. The stack protector configuration system is a complete mess. There are multiple overlapping controls, used in 3 different places. Some of the target control implementations overlap with conditions used in the emission points, and some use correlated but not identical conditions in different contexts. i.e. useLoadStackGuardNode, getIRStackGuard, getSSPStackGuardCheck and insertSSPDeclarations are all used in inconsistent ways so I don't know if I've tracked the intention of the system correctly. The PowerPC test change is a bug fix on linux. Previously the manual conditions were based around !isOSOpenBSD, which is not the condition where __stack_chk_guard are used. Now getSDagStackGuard returns the proper global reference, resulting in LOAD_STACK_GUARD getting a MachineMemOperand which allows scheduling.
2025-08-16Reapply "RuntimeLibcalls: Generate table of libcall name lengths (#153… ↵Matt Arsenault1-25/+22
(#153864) This reverts commit 334e9bf2dd01fbbfe785624c0de477b725cde6f2. Check if llvm-nm exists before building the benchmark.
2025-08-15Revert "RuntimeLibcalls: Generate table of libcall name lengths (#153… ↵gulfemsavrun1-22/+25
(#153864) …210)" This reverts commit 9a14b1d254a43dc0d4445c3ffa3d393bca007ba3. Revert "RuntimeLibcalls: Return StringRef for libcall names (#153209)" This reverts commit cb1228fbd535b8f9fe78505a15292b0ba23b17de. Revert "TableGen: Emit statically generated hash table for runtime libcalls (#150192)" This reverts commit 769a9058c8d04fc920994f6a5bbb03c8a4fbcd05. Reverted three changes because of a CMake error while building llvm-nm as reported in the following PR: https://github.com/llvm/llvm-project/pull/150192#issuecomment-3192223073
2025-08-15Move function info word into its own data structure (#153627)Sterling-Augustine1-2/+2
The sframe generator needs to construct this word separately from FDEs themselves, so split them into a separate data structure.
2025-08-15[llvm-readobj] Dump SFrame relocations as well (#153161)Pavel Labath1-8/+11
If there is a relocation for a particular FDE, print it as well. This is mainly meant for human consumption (otherwise, there's no way to tell which function a given (relocatable) FDE refers to). For testing of relocation generation, I'd still recommend using the regular relocation dumper, as this code will not detect (e.g.) any superfluous relocations. I've considered handling relocations inside the SFrameParser class, but I couldn't find an elegant way to do that. Right now, I don't have a use case for resolving relocations there as lldb (my other use case for SFrameParser) will always operate on linked objects.
2025-08-15TableGen: Emit statically generated hash table for runtime libcalls (#150192)Matt Arsenault1-25/+22
a96121089b9c94e08c6632f91f2dffc73c0ffa28 reverted a change to use a binary search on the string name table because it was too slow. This replaces it with a static string hash table based on the known set of libcall names. Microbenchmarking shows this is similarly fast to using DenseMap. It's possibly slightly slower than using StringSet, though these aren't an exact comparison. This also saves on the one time use construction of the map, so it could be better in practice. This search isn't simple set check, since it does find the range of possible matches with the same name. There's also an additional check for whether the current target supports the name. The runtime constructed set doesn't require this, since it only adds the symbols live for the target. Followed algorithm from this post http://0x80.pl/notesen/2023-04-30-lookup-in-strings.html I'm also thinking the 2 special case global symbols should just be added to RuntimeLibcalls. There are also other global references emitted in the backend that aren't tracked; we probably should just use this as a centralized database for all compiler selected symbols.
2025-08-12Reapply "[Object] Parsing and dumping of SFrame Frame Row Entries" (#152650) ↵Pavel Labath1-4/+129
(#152695) This reapplies #152650 with a build fix for clang-11 (need explicit template parameters for ArrayRef construction) and avoiding the default-in-a-switch-covering-enum warning. It also adds two new tests. The original commit message was: The trickiest part here is that the FREs have a variable size, in two (or three?) dimensions: - the size of the StartAddress field. This determined by the FDE they are in, so it is uniform across all FREs in one FDE. - the number and sizes of offsets following the FRE. This can be different for each FRE. While vending this information through a template API would be possible, I believe such an approach would be very unwieldy, and it would still require a sequential scan through the FRE list. This is why I'm implementing this by reading the data into a common data structure using the fallible iterator pattern. For more information about the SFrame unwind format, see the [specification](https://sourceware.org/binutils/wiki/sframe) and the related [RFC](https://discourse.llvm.org/t/rfc-adding-sframe-support-to-llvm/86900).
2025-08-08Revert "[Object] Parsing and dumping of SFrame Frame Row Entries" (#152650)Pavel Labath1-128/+4
Reverts llvm/llvm-project#151301 - build breakage on multiple bots.
2025-08-08[Object] Parsing and dumping of SFrame Frame Row Entries (#151301)Pavel Labath1-4/+128
The trickiest part here is that the FREs have a variable size, in two (or three?) dimensions: - the size of the StartAddress field. This determined by the FDE they are in, so it is uniform across all FREs in one FDE. - the number and sizes of offsets following the FRE. This can be different for each FRE. While vending this information through a template API would be possible, I believe such an approach would be very unwieldy, and it would still require a sequential scan through the FRE list. This is why I'm implementing this by reading the data into a common data structure using the fallible iterator pattern. For more information about the SFrame unwind format, see the [specification](https://sourceware.org/binutils/wiki/sframe) and the related [RFC](https://discourse.llvm.org/t/rfc-adding-sframe-support-to-llvm/86900).
2025-08-06[llvm-objdump] Fix typo in error messages (#152234)Daniel Rodríguez Troitiño1-2/+2
Some error messages were spelling "children" as "childern".
2025-08-04[DirectX] Add ObjectFile boilerplate for objdump (#151434)Chris B5-2/+189
This change adds boilerplate code to implement the object::ObjectFile interface for the DXContainer object file and an empty implementation of the objdump Dumper object. Adding an ObjectFile implementation for DXContainer is a bit odd because the DXContainer format doesn't have a symbol table, so there isn't a reasonable implementation for the SymbolicFile interfaces. That said, it does have sections, and it will be useful for objdump to be able to inspect some of the structured data stored in some of the special named sections. At this point in the implementation it can't do much other than dump the part names, offsets, and sizes. Dumping detailed structured section contents to be extended in subsequent PRs. Fixes #151433
2025-07-31[ELF] handle new NVIDIA GPU variants. (#151604)Artem Belevich1-0/+9
2025-07-30[Object] Parsing and dumping of SFrame FDEs (#149828)Pavel Labath1-9/+58
Also known as Function Description Entries. The entries occupy a contiguous piece of the section, so the code is mostly straight-forward. For more information about the SFrame unwind format, see the [specification](https://sourceware.org/binutils/wiki/sframe) and the related [RFC](https://discourse.llvm.org/t/rfc-adding-sframe-support-to-llvm/86900).
2025-07-29[llvm] annotate recently added interfaces for DLL export (#150101)Andrew Rogers1-2/+3
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates symbols that were recently added to LLVM without proper annotations. The annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build. ## Background This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). ## Overview The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS: - Add `LLVM_EXPORT_TEMPLATE` and `LLVM_TEMPLATE_ABI` annotations to explicitly instantiated instances of `llvm::object::SFrameParser`. ## Validation Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: - Windows with MSVC - Windows with Clang - Linux with GCC - Linux with Clang - Darwin with Clang
2025-07-28IRSymtab: Use StringSet instead of DenseMap for preserved symbols (#149836)Matt Arsenault1-5/+6
Microbenchmarking shows this is faster
2025-07-21[LLVM] Update CUDA ELF flags for their new ABI (#149534)Joseph Huber1-2/+15
Summary: We rely on these flags to do things in the runtime and print the contents of binaries correctly. CUDA updated their ABI encoding recently and we didn't handle that. it's a new ABI entirely so we just select on it when it shows up. Fixes: https://github.com/llvm/llvm-project/issues/148703
2025-07-21[Object] Beginnings of SFrame parser and dumper (#147294)Pavel Labath2-0/+56
This PR adds the SFrameParser class and uses it from llvm-readobj to dump the section contents. Currently, it only supports parsing the SFrame section header. Other parts of the section will be added in follow-up patches. llvm-readobj uses the same sframe flag syntax as GNU readelf, but I have not attempted match the output format of the tool. I'm starting with the "llvm" output format because it's easier to generate and lets us tweak the format to make it useful for testing the generation code. If needed, support for the GNU format could be added by overriding this functionality in the GNU ELF Dumper. For more information, see the [sframe specification](https://sourceware.org/binutils/wiki/sframe) and the related [RFC](https://discourse.llvm.org/t/rfc-adding-sframe-support-to-llvm/86900).
2025-07-18Add section type to support CFI jump table relaxation.Peter Collingbourne1-0/+1
For context see main pull request: #147424. Reviewers: MaskRay Reviewed By: MaskRay Pull Request: https://github.com/llvm/llvm-project/pull/149259
2025-07-18Revert "RuntimeLibcalls: Add methods to recognize libcall names (#149001)"Nikita Popov1-22/+23
This reverts commit 45477add8dfe9851605697bd908b49f0ec244625. This causes a significant LTO compile-time regression.
2025-07-18RuntimeLibcalls: Add methods to recognize libcall names (#149001)Matt Arsenault1-23/+22
Also replace the current static DenseMap of preserved symbol names in the Symtab hack with this. That was broken statefulness across compiles, so this at least fixes that. However this is still broken, llvm-as shouldn't really depend on the triple.
2025-07-17[llvm-objcopy][libObject] Add RISC-V big-endian support (#146913)Djordje Todorovic1-1/+5
Add support for big-endian RISC-V ELF files: - Add riscv32be/riscv64be target architectures to Triple - Support elf32-bigriscv and elf64-bigriscv output targets in llvm-objcopy - Update ELFObjectFile to handle BE RISC-V format strings and architecture detection - Add BE RISC-V support to RelocationResolver - Add tests for new functionality This is a subset of a bigger RISC-V big-endian support patch, containing only the llvm-objcopy and libObject changes. Other changes will be added later.
2025-07-16[elf] Add support for {SHT,PT}_GNU_SFRAME constants (#148803)Pavel Labath1-0/+1
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-16[llvm-objdump][RISCV] Display `@plt' symbols when disassembling .plt section ↵Ming-Yi Lai1-0/+4
(#147933) This patch adds dummy symbols for PLT entries for RISC-V 32-bit and 64-bit targets so llvm-objdump can show the function symbol that corresponds to each PLT entry.
2025-07-14[llvm] Remove unused includes (NFC) (#148768)Kazu Hirata1-1/+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-07-02clang-format ELF.cppRahman Lavaee1-2/+2
2025-07-02[SHT_LLVM_BB_ADDR_MAP] Cleanup old version support code from ELF.cpp.Rahman Lavaee1-9/+3
This change was mistakenly dropped from the prior commit 6b623a6622707ea47d84ab0069f766215a6fec44
2025-07-02[SHT_LLVM_BB_ADDR_MAP] Remove support for versions 1 and 0 ↵Rahman Lavaee2-30/+19
(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-27TableGen: Generate enum for runtime libcall implementations (#144973)Matt Arsenault1-3/+3
Work towards separating the ABI existence of libcalls vs. the lowering selection. Set libcall selection through enums, rather than through raw string names.