summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [llvm/Object] - Make ELFObjectFile::getRelocatedSection return ↵George Rimar2019-10-211-2/+12
| | | | | | | | | | | | | Expected<section_iterator> It returns just a section_iterator currently and have a report_fatal_error call inside. This change adds a way to return errors and handle them on caller sides. The patch also changes/improves current users and adds test cases. Differential revision: https://reviews.llvm.org/D69167 llvm-svn: 375408
* [llvm] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-151-3/+3
| | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
* Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return ↵George Rimar2019-08-141-11/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expected<>" Changes: no changes. A fix for the clang code will be landed right on top. Original commit message: SectionRef::getName() returns std::error_code now. Returning Expected<> instead has multiple benefits. For example, it forces user to check the error returned. Also Expected<> may keep a valuable string error message, what is more useful than having a error code. (Object\invalid.test was updated to show the new messages printed.) This patch makes a change for all users to switch to Expected<> version. Note: in a few places the error returned was ignored before my changes. In such places I left them ignored. My intention was to convert the interface used, and not to improve and/or the existent users in this patch. (Though I think this is good idea for a follow-ups to revisit such places and either remove consumeError calls or comment each of them to clarify why it is OK to have them). Differential revision: https://reviews.llvm.org/D66089 llvm-svn: 368826
* Revert r368812 "[llvm/Object] - Convert SectionRef::getName() to return ↵George Rimar2019-08-141-23/+11
| | | | | | | | Expected<>" It broke clang BB: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/16455 llvm-svn: 368813
* [llvm/Object] - Convert SectionRef::getName() to return Expected<>George Rimar2019-08-141-11/+23
| | | | | | | | | | | | | | | | | | | | | | | SectionRef::getName() returns std::error_code now. Returning Expected<> instead has multiple benefits. For example, it forces user to check the error returned. Also Expected<> may keep a valuable string error message, what is more useful than having a error code. (Object\invalid.test was updated to show the new messages printed.) This patch makes a change for all users to switch to Expected<> version. Note: in a few places the error returned was ignored before my changes. In such places I left them ignored. My intention was to convert the interface used, and not to improve and/or the existent users in this patch. (Though I think this is good idea for a follow-ups to revisit such places and either remove consumeError calls or comment each of them to clarify why it is OK to have them). Differential revision: https://reviews.llvm.org/D66089 llvm-svn: 368812
* [RuntimeDyld] Decouple RuntimeDyldChecker from RuntimeDyld.Lang Hames2019-04-081-3/+0
| | | | | | | This will allow RuntimeDyldChecker (and rtdyld-check tests) to test a new JIT linker: JITLink (https://reviews.llvm.org/D58704). llvm-svn: 357947
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [Support] Make error banner optional in logAllUnhandledErrorsJonas Devlieghere2018-11-111-3/+3
| | | | | | | | In a lot of places an empty string was passed as the ErrorBanner to logAllUnhandledErrors. This patch makes that argument optional to simplify the call sites. llvm-svn: 346604
* 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
OpenPOWER on IntegriCloud