summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing spaceFangrui Song2018-07-301-1/+1
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338293
* [RuntimeDyld] Implement the ELF PIC large code model relocationsReid Kleckner2018-06-221-0/+43
| | | | | | | Prerequisite for https://reviews.llvm.org/D47211 which improves our ELF large PIC codegen. llvm-svn: 335402
* [PPC64] Support "symbol@high" and "symbol@higha" symbol modifers.Sean Fertile2018-06-151-0/+2
| | | | | | | | | | Add support for the "@high" and "@higha" symbol modifiers in powerpc64 assembly. The modifiers represent accessing the segment consiting of bits 16-31 of a 64-bit address/offset. Differential Revision: https://reviews.llvm.org/D47729 llvm-svn: 334855
* [PowerPC] fix broken JIT-compiled code with tail call optimizationHiroshi Inoue2018-05-301-2/+3
| | | | | | | | | The relocation for branch instructions in the dynamic loader of ExecutionEngine assumes branch instructions with R_PPC64_REL24 relocation type are only bl. However, with the tail call optimization, b instructions can be also used to jump into another function. This patch makes the relocation to keep bits in the branch instruction other than the jump offset to avoid relocation rewrites a b instruction into bl. Differential Revision: https://reviews.llvm.org/D47456 llvm-svn: 333502
* Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-141-43/+44
| | | | | | | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
* [RuntimeDyld][PowerPC] Use global entry points for calls between sections.Lang Hames2018-04-051-9/+13
| | | | | | | | | | | | | | | | | | Functions in different objects may use different TOCs, so calls between such functions should use the global entry point of the callee which updates the TOC pointer. This should fix a bug that the Numba developers encountered (see https://github.com/numba/numba/issues/2451). Patch by Olexa Bilaniuk. Thanks Olexa! No RuntimeDyld checker test case yet as I am not familiar enough with how RuntimeDyldELF fixes up call-sites, but I do not want to hold up landing this. I will continue to work on it and see if I can rope some powerpc experts in. llvm-svn: 329335
* Move getPlatformFlags to ELFObjectFileBase and simplify.Rafael Espindola2018-01-291-10/+8
| | | | | | | This removes a few std::error_code results that were ignored on every call. llvm-svn: 323674
* Handle R_386_PLT32 in RuntimeDyldELF.Rafael Espindola2018-01-241-0/+3
| | | | | | This should fix the 32 bit buildbots. llvm-svn: 323344
* Remove ELFDataTypeTypedefHelper class.Rui Ueyama2018-01-121-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D41973 llvm-svn: 322395
* Instead of ELFFile<ELFT>::Type, use ELFT::Type. NFC.Rui Ueyama2018-01-121-1/+1
| | | | llvm-svn: 322346
* Remove redundant includes from lib/ExecutionEngine.Michael Zolotukhin2017-12-131-2/+0
| | | | llvm-svn: 320621
* [mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in RuntimeDyld.Nitesh Jain2017-10-221-6/+75
| | | | | | | | | | Reviewers: sdardis Subscribers: jaydeep, bhushan, llvm-commits Differential Revision: https://reviews.llvm.org/D38314 llvm-svn: 316287
* Convert an ErrorOr to Expected.Rafael Espindola2017-10-111-3/+6
| | | | | | | getRelocationAddend should never be called on non SHT_RELA sections, but changing that requires changing RelocVisitor.h. llvm-svn: 315473
* Make the ELFObjectFile constructor private.Rafael Espindola2017-10-101-8/+23
| | | | | | | This forces every user to use the new create method that returns an Expected. This in turn propagates better error messages. llvm-svn: 315371
* Try to make gcc happy.Rafael Espindola2017-10-101-1/+1
| | | | llvm-svn: 315349
* Return Expected from createRTDyldELFObject.Rafael Espindola2017-10-101-17/+18
| | | | | | | No functionality change, it just makes it easier to use Expected in Object. llvm-svn: 315348
* Simplify. NFC.Rafael Espindola2017-10-101-16/+10
| | | | llvm-svn: 315347
* Revert "Revert "ExecutionEngine: add R_AARCH64_ABS{16,32}""Saleem Abdulrasool2017-09-201-0/+12
| | | | | | | | | | | This reverts commit SVN r313668. The original test case attempted to write a pointer value into 16-bits, although the value may exceed the range representable in 16-bits. Ensure that the symbol is located in the address space such that its absolute address is representable in 16-bits. This should fix the assertion failure that was seen on the Windows hosts. llvm-svn: 313822
* Revert "ExecutionEngine: add R_AARCH64_ABS{16,32}"Saleem Abdulrasool2017-09-191-12/+0
| | | | | | | | This reverts commit SVN r313654. Seems that it is triggering an assertion on Windows specifically. Revert until I can build on Windows and look into what is happening there. llvm-svn: 313668
* ExecutionEngine: add R_AARCH64_ABS{16,32}Saleem Abdulrasool2017-09-191-0/+12
| | | | | | | | | | Add support for the R_AARCH64_ABS{16,32} relocations in the execution engine. This is primarily used for DWARF debug information relocations and needed by the LLVM JIT to support JITing for lldb. Patch by Alex Langford! llvm-svn: 313654
* RuntimeDyldELF.cpp: Prune unused "TargetRegistry.h"NAKAMURA Takumi2017-07-231-1/+0
| | | | llvm-svn: 308846
* DebugInfo: Generalize LoadedObjectInfoHelper from RuntimeDyldDavid Blaikie2017-07-051-1/+2
| | | | | | | | Make it usable by any class derived (even indirectly) from LoadedObjectInfo by allowing a custom base class to be specified and perfect forwarding to the ctor. llvm-svn: 307166
* Remove `inline` keyword from inline `classof` methodsSam Clegg2017-06-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | The style guide states that the explicit `inline` should not be used with inline methods. classof is very common inline method with a fair amount on inconsistency: $ git grep classof ./include | grep inline | wc -l 230 $ git grep classof ./include | grep -v inline | wc -l 257 I chose to target this method rather the larger change since this method is easily cargo-culted (I did it at least once). I considered doing the larger change and removing all occurrences but that would be a much larger change. Differential Revision: https://reviews.llvm.org/D33906 llvm-svn: 306731
* Revert [mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in ↵Sagar Thakur2017-06-221-83/+8
| | | | | | | | RuntimeDyld Reverting due to build bot failures llvm-svn: 306000
* [mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in RuntimeDyldSagar Thakur2017-06-221-8/+83
| | | | | | | | | After the N64 static relocation model support was added to llvm it is required to add its support in RuntimeDyld also because lldb uses ExecutionEngine for evaluating expressions. Reviewed by sdardis Differential: D31649 llvm-svn: 305997
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-071-1/+1
| | | | | | | | | | | | This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
* [RuntimeDyld, PowerPC] Fix regression from r303637Ulrich Weigand2017-05-231-7/+9
| | | | | | | | | | | | | | Actually, to identify external symbols, we need to check for *either* non-null Value.SymbolName *or* a SymType of Symbol::ST_Unknown. The former may happen for symbols not known to the JIT at all (e.g. defined in a native library), while the latter happens for symbols known to the JIT, but defined in a different module. Fixed several regressions on big-endian ppc64. llvm-svn: 303655
* [RuntimeDyld, PowerPC] Fix check for external symbols when detecting ↵Ulrich Weigand2017-05-231-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | reloction overflow The PowerPC part of processRelocationRef currently assumes that external symbols can be identified by checking for SymType == SymbolRef::ST_Unknown. This is actually incorrect in some cases, causing relocation overflows to be mis-detected. The correct check is to test whether Value.SymbolName is null. Includes test case. Note that it is a bit tricky to replicate the exact condition that triggers the bug in a test case. The one included here seems to fail reliably (before the fix) across different operating system versions on Power, but it still makes a few assumptions (called out in the test case comments). Also add ppc64le platform name to the supported list in the lit.local.cfg files for the MCJIT and OrcMCJIT directories, since those tests were currently not run at all. Fixes PR32650. Reviewer: hfinkel Differential Revision: https://reviews.llvm.org/D33402 llvm-svn: 303637
* [RuntimeDyld, PowerPC] Fix relocation detection overflowUlrich Weigand2017-05-231-8/+8
| | | | | | | | | | | | | | | | Code in RuntimeDyldELF currently uses 32-bit temporaries to detect whether a PPC64 relocation target is out of range. This is incorrect, and can mis-detect overflow where the distance between relocation site and target is close to a multiple of 4GB. Fixed by using 64-bit temporaries. Noticed while debugging PR32650. Reviewer: hfinkel Differential Revision: https://reviews.llvm.org/D33403 llvm-svn: 303632
* [ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EHLang Hames2017-05-091-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | frames. RuntimeDyld was previously responsible for tracking allocated EH frames, but it makes more sense to have the RuntimeDyld::MemoryManager track them (since the frames are allocated through the memory manager, and written to memory owned by the memory manager). This patch moves the frame tracking into RTDyldMemoryManager, and changes the deregisterFrames method on RuntimeDyld::MemoryManager from: void deregisterEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size); to: void deregisterEHFrames(); Separating this responsibility will allow ORC to continue to throw the RuntimeDyld instances away post-link (saving a few dozen bytes per lazy function) while properly deregistering frames when modules are unloaded. This patch also updates ORC to call deregisterEHFrames when modules are unloaded. This fixes a bug where an exception that tears down the JIT can then unwind through dangling EH frames that have been deallocated but not deregistered, resulting in UB. For people using SectionMemoryManager this should be pretty much a no-op. For people with custom allocators that override registerEHFrames/deregisterEHFrames, you will now be responsible for tracking allocated EH frames. Reviewed in https://reviews.llvm.org/D32829 llvm-svn: 302589
* [SystemZ] Support missing relocation types in RuntimeDyldELFUlrich Weigand2017-05-091-3/+18
| | | | | | | | | Handle some more relocation types in RuntimeDyldELF::resolveSystemZRelocation This fixes a number of failing LLDB test cases. llvm-svn: 302565
* [bpf] add relocation supportAlexei Starovoitov2017-05-031-0/+32
| | | | | | | | | | . there should be no runtime relocation inside the bpf function. . relocation supported here mostly for debugging. . a test case is added. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 302055
* RuntimeDyldELF/AArch64: Implement basic GOT supportEugene Leviant2017-02-061-66/+123
| | | | | | | | | This patch implements two GOT relocations: R_AARCH64_ADR_GOT_PAGE and R_AARCH64_LD64_GOT_LO12_NC Differential revision: https://reviews.llvm.org/D28571 llvm-svn: 294191
* RuntimeDyldELF: Don't abort on R_X86_64_NONE, it's a no-oop.Will Dietz2017-01-281-0/+2
| | | | llvm-svn: 293388
* RuntimeDyldELF: add LDST128_ABS_LO12_NC relocEugene Leviant2017-01-231-0/+6
| | | | llvm-svn: 292788
* RuntimeDyldELF: add LDST8_ABS_LO12_NC and LDST16_ABS_LO12_NC relocsEugene Leviant2017-01-231-1/+13
| | | | | | Differential revision: https://reviews.llvm.org/D28863 llvm-svn: 292785
* RuntimeDyldELF: implement R_AARCH64_PREL64 relocEugene Leviant2017-01-101-0/+3
| | | | | | Differential revision: https://reviews.llvm.org/D28122 llvm-svn: 291558
* Fix MSVC build failure introduced in r291431Pavel Labath2017-01-091-4/+3
| | | | | | | MSVC does not like to reinterpret_cast to a uint64_t. Use a different cast instead. llvm-svn: 291435
* RuntimeDyldELF: don't create thunk if not neededEugene Leviant2017-01-091-1/+44
| | | | | | | | | | | | | This patch doesn't create thunk for branch operation when following conditions are met: - Architecture is AArch64 - Relocation target is in the same object file - Relocation target is close enough to be encoded in immediate offset In such case we branch directly to the target instead of branching to thunk Differential revision: https://reviews.llvm.org/D28108 llvm-svn: 291431
* RuntimeDyldELF: refactor AArch64 relocations. NFC.Eugene Leviant2016-12-271-106/+44
| | | | llvm-svn: 290606
* RuntimeDyldELF: add R_AARCH64_ADD_ABS_LO12_NC relocEugene Leviant2016-12-271-0/+9
| | | | | | Differential revision: https://reviews.llvm.org/D28115 llvm-svn: 290598
* Fix R_AARCH64_MOVW_UABS_G3 relocationYichao Yu2016-12-151-23/+49
| | | | | | | | | | | | Summary: The relocation is missing mask so an address that has non-zero bits in 47:43 may overwrite the register number. (Frequently shows up as target register changed to `xzr`....) Reviewers: t.p.northover, lhames Subscribers: davide, aemerson, rengolin, llvm-commits Differential Revision: https://reviews.llvm.org/D27609 llvm-svn: 289880
* [mips][rtdyld] Move MIPS relocation resolution to a subclass and implement ↵Simon Dardis2016-12-131-282/+16
| | | | | | | | | | | | | | | N32 relocations N32 relocations are only correct for individual relocations at the moment. Support for relocation composition will follow in a later patch. Patch By: Daniel Sanders Reviwers: vkalintiris, atanasyan Differential Revision: https://reviews.llvm.org/D27467 llvm-svn: 289532
* [mips][rtdyld] Merge code to write relocated values to the section. NFCSimon Dardis2016-12-071-124/+107
| | | | | | | | | | | | Preparation work for implementing N32 support. Patch By: Daniel Sanders Reviewers: vkalintiris, atanasyan Differential Revision: https://reviews.llvm.org/D27460 llvm-svn: 288900
* Fix cross-endianness RuntimeDyld relocation for ARMKeno Fischer2016-10-201-9/+10
| | | | | | | | | rL284780 fixed the PREL31 relocation and added a test for it. Being the first such test for ARM relocations, it exposed incorrect endianness assumptions (causing buildbot failures on big-endian hosts). Fix that by using the same helpers used for the x86 case. llvm-svn: 284789
* Fix PREL31 relocation on ARMKeno Fischer2016-10-201-0/+4
| | | | | | | | | | | | | Summary: This is a 31bits relative relocation instead of a 32bits absolute relocation. Reviewers: t.p.northover, peter.smith, rengolin Subscribers: aemerson, llvm-commits, samparker Differential Revision: https://reviews.llvm.org/D25069 llvm-svn: 284780
* [mips][mcjit] Add the majority of N32 support.Simon Dardis2016-10-201-14/+28
| | | | | | | | | The missing piece is relocation composition for %hi(%neg(%gp_rel(x))) and similar. Patch by: Daniel Sanders llvm-svn: 284724
* [RuntimeDyld] Revert r279182 and 279201 -- they broke some ARM bots.Lang Hames2016-08-191-16/+0
| | | | llvm-svn: 279275
* [RuntimeDyld] Add support for ELF R_ARM_REL32 and R_ARM_GOT_PREL.Lang Hames2016-08-191-0/+16
| | | | | | | | | | | | | | | | Patch by William Dillon. Thanks William! This patch adds support for the R_ARM_REL32 and R_ARM_GOT_PREL ELF ARM relocations to RuntimeDyld, which should allow JITing of code that produces these relocations. No test case: Unfortunately RuntimeDyldELF's GOT building mechanism (which uses a separate section for GOT entries) isn't compatible with RuntimeDyldChecker. The correct fix for this is to fix RuntimeDyldELF's GOT support (it's fundamentally broken at the moment: separate sections aren't guaranteed to be in range of a GOT entry load), but that's a non-trivial job. llvm-svn: 279182
* Re-apply r278065 (Weak symbol support in RuntimeDyld) with a fix for ELF.Lang Hames2016-08-091-0/+1
| | | | llvm-svn: 278149
OpenPOWER on IntegriCloud