summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld/Targets
Commit message (Collapse)AuthorAgeFilesLines
* [ExecutionEngine] Add a missing break to avoid warningsMartin Storsjö2019-11-201-0/+1
| | | | This fixes buildbot errors since dc3ee330891c2.
* ExecutionEngine: add preliminary support for COFF ARM64Adam Kallai2019-11-201-0/+364
| | | | Differential Revision: https://reviews.llvm.org/D69434
* Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return ↵George Rimar2019-08-143-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-143-12/+6
| | | | | | | | 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-143-6/+12
| | | | | | | | | | | | | | | | | | | | | | | 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] Apply padding and alignment bumps to all sections with stubs, andLang Hames2019-05-301-1/+1
| | | | | | | | | | | | | increase the MachO/x86-64 stub alignment to 8. Stub alignment should be guaranteed for any section containing RuntimeDyld stubs/GOT-entries. To do this we should pad and align all sections containing stubs, not just code sections. This commit also bumps the MachO/x86-64 stub alignment to 8, so that GOT entries will be aligned. llvm-svn: 362139
* [RuntimeDyld][ARM] Fix an incorrect assertion condition.Lang Hames2019-05-271-1/+1
| | | | | | Fixes https://llvm.org/PR42036 llvm-svn: 361782
* Simplify decoupling between RuntimeDyld/RuntimeDyldChecker, add 'got_addr' util.Lang Hames2019-04-127-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | This patch reduces the number of functions in the interface between RuntimeDyld and RuntimeDyldChecker by combining "GetXAddress" and "GetXContent" functions into "GetXInfo" functions that return a struct describing both the address and content. The GetStubOffset function is also replaced with a pair of utilities, GetStubInfo and GetGOTInfo, that fit the new scheme. For RuntimeDyld both of these functions will return the same result, but for the new JITLink linker (https://reviews.llvm.org/D58704) these will provide the addresses of PLT stubs and GOT entries respectively. For JITLink's use, a 'got_addr' utility has been added to the rtdyld-check language, and the syntax of 'got_addr' and 'stub_addr' has been changed: both functions now take two arguments, a 'stub container name' and a target symbol name. For llvm-rtdyld/RuntimeDyld the stub container name is the object file name and section name, separated by a slash. E.g.: rtdyld-check: *{8}(stub_addr(foo.o/__text, y)) = y For the upcoming llvm-jitlink utility, which creates stubs on a per-file basis rather than a per-section basis, the container name is just the file name. E.g.: jitlink-check: *{8}(got_addr(foo.o, y)) = y llvm-svn: 358295
* Add namespace to some types.Richard Trieu2019-01-313-18/+21
| | | | llvm-svn: 352725
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-199-36/+27
| | | | | | | | | | | | | | | | | 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
* Implement IMAGE_REL_AMD64_SECREL for RuntimeDyldCOFFX86_64Nathan Lanza2018-12-121-0/+7
| | | | | | | | lldb on Windows uses the ExecutionEngine for expression evaluation and hits the llvm_unreachable due to this relocation. Thus, implement the relocation and add a test to verify it's function. llvm-svn: 348904
* [Support] Make error banner optional in logAllUnhandledErrorsJonas Devlieghere2018-11-111-1/+1
| | | | | | | | 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
* [RuntimeDyld][COFF] Skip non-loaded sections when calculating ImageBase.Lang Hames2018-10-231-1/+7
| | | | | | | | | | | | | | | | | | Non-loaded sections (whose unused load-address defaults to zero) should not be taken into account when calculating ImageBase, or ImageBase will be incorrectly set to 0. Patch by Andrew Scheidecker. Thanks Andrew! https://reviews.llvm.org/D51343 + // The Sections list may contain sections that weren't loaded for + // whatever reason: they may be debug sections, and ProcessAllSections + // is false, or they may be sections that contain 0 bytes. If the + // section isn't loaded, the load address will be 0, and it should not + // be included in the ImageBase calculation. llvm-svn: 344995
* [ORC] Add a 'Callable' flag to JITSymbolFlags.Lang Hames2018-08-011-2/+4
| | | | | | | | | | | | | The callable flag can be used to indicate that a symbol is callable. If present, the symbol is callable. If absent, the symbol may or may not be callable (the client must determine this by context, for example by examining the program representation that will provide the symbol definition). This flag will be used in the near future to enable creation of lazy compilation stubs based on SymbolFlagsMap instances only (without having to provide additional information to determine which symbols need stubs). llvm-svn: 338649
* [RuntimeDyld][MachO] Add support for MachO::ARM64_RELOC_POINTER_TO_GOT reloc.Lang Hames2018-05-231-8/+48
| | | | llvm-svn: 333130
* Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-148-93/+100
| | | | | | | | | | | | | | | | 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][MachO] Properly handle thumb to thumb calls within a section.Lang Hames2018-05-091-1/+19
| | | | | | | | | | | Previously thumb bits were only checked for external relocations (thumb to arm code and vice-versa). This patch adds detection for thumb callees in the same section asthe (also thumb) caller. The MachO/Thumb test case is updated to cover this, and redundant checks (handled by the MachO/ARM test) are removed. llvm-svn: 331838
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-2/+2
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* Reapply r329133 with fix.Lang Hames2018-04-041-5/+36
| | | | llvm-svn: 329136
* Revert r329133 "[RuntimeDyld][AArch64] Add some error pluming / generation..."Lang Hames2018-04-041-32/+4
| | | | | | This broke a number of buildbots. Looking in to it now... llvm-svn: 329135
* [RuntimeDyld][AArch64] Add some error pluming / generation to catch unhandledLang Hames2018-04-031-4/+32
| | | | | | relocation types on AArch64. llvm-svn: 329133
* [RuntimeDyld][MachO] Fix assertion in encodeAddend, add missing directive toLang Hames2018-03-011-3/+5
| | | | | | | | | | | | test case. r326290 fixed the assertion for decodeAddend, but not encodeAddend. The regression test failed to catch this because it was missing the subsections_via_symbols flag, so the desired relocation was not applied. This patch also fixes the formatting of the assertion from r326290. llvm-svn: 326406
* [RuntimeDyld][MachO] Support ARM64_RELOC_BRANCH26 for BL instructions byLang Hames2018-02-281-2/+4
| | | | | | relaxing an assertion. llvm-svn: 326290
* Handle IMAGE_REL_AMD64_ADDR32NB in RuntimeDyldCOFFFrederich Munch2018-02-211-21/+94
| | | | | | | | | | | | | | | | Summary: IMAGE_REL_AMD64_ADDR32NB relocations are currently set to zero in all cases. This patch sets the relocation to the correct value when possible and shows an error when not. Reviewers: enderby, lhames, compnerd Reviewed By: compnerd Subscribers: LepelTsmok, compnerd, martell, llvm-commits Differential Revision: https://reviews.llvm.org/D30709 llvm-svn: 325700
* ExecutionEngine: make COFF Thumb2 assertions non-tautologicalSaleem Abdulrasool2017-10-221-25/+11
| | | | | | | | | The overflow detection assertions were tautological due to truncation. Adjust them to no longer be tautological. Patch by Alex Langford! llvm-svn: 316303
* [mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in RuntimeDyld.Nitesh Jain2017-10-221-1/+10
| | | | | | | | | | Reviewers: sdardis Subscribers: jaydeep, bhushan, llvm-commits Differential Revision: https://reviews.llvm.org/D38314 llvm-svn: 316287
* ExecutionEngine: adjust COFF i386 tautological assertsSaleem Abdulrasool2017-10-191-16/+6
| | | | | | | | | Modify static_casts to not be tautological in some COFF i386 relocations. Patch by Alex Langford! llvm-svn: 316169
* [ExecutionEngine] Correct the size of a write in a COFF i386 relocationShoaib Meenai2017-10-171-1/+1
| | | | | | | | | | | We want to be writing a 32bit value, so we should be writing 4 bytes instead of 2. Patch by Alex Langford <apl@fb.com>. Differential Revision: https://reviews.llvm.org/D38872 llvm-svn: 315964
* [RuntimeDyld][ORC] Add support for Thumb mode to RuntimeDyldMachOARM.Lang Hames2017-08-091-16/+126
| | | | | | | | | | | This patch adds support for thumb relocations to RuntimeDyldMachOARM, and adds a target-specific flags field to JITSymbolFlags (so that on ARM we can record whether each symbol is Thumb-mode code). RuntimeDyldImpl::emitSection is modified to ensure that stubs memory is correctly aligned based on the size returned by getStubAlignment(). llvm-svn: 310517
* [RuntimeDyld][MachO/ARM] Don't add a redundant relocation entry.Lang Hames2017-07-181-1/+0
| | | | | | We only need to add this entry once for it to be fixed up. llvm-svn: 308375
* Revert [mips] Adds support for R_MIPS_26, HIGHER, HIGHEST relocations in ↵Sagar Thakur2017-06-221-6/+0
| | | | | | | | 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-0/+6
| | | | | | | | | 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-074-4/+4
| | | | | | | | | | | | 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
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-063-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* [ExecutionEngine] Make RuntimeDyld::MemoryManager responsible for tracking EHLang Hames2017-05-093-5/+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
* [mips][rtdyld] Move MIPS relocation resolution to a subclass and implement ↵Simon Dardis2016-12-132-0/+380
| | | | | | | | | | | | | | | 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
* Handle relocations to thumb functions when dynamic linking COFF modulesWalter Erquinigo2016-10-171-5/+39
| | | | | | | | | | | | | | | | Summary: This adds the necessary logic to support relocations to thumb functions in the COFF dynamic linker. The jumps to function addresses are mostly blx, which requires the ISA selection bit when jumping to a thumb function. Note: I'm determining if the relocation requires the ISA bit when creating the relocation entries and not when resolving the relocation. I have to do that because I need the ObjectFile and the actual Symbol, which are available only when creating the entries. It would require a gross refactor if I do it otherwise, but I'm okay with doing it if you think it's better. Reviewers: peter.smith, compnerd Subscribers: rengolin, sas Differential Revision: https://reviews.llvm.org/D25151 llvm-svn: 284410
* ExecutionEngine: fix a bug in the movt/movw relocatorSaleem Abdulrasool2016-08-291-1/+1
| | | | | | | | | | According to the arm arm specifications, 4 bytes are needed for a shift instead of 8, this was causing the movt instruction to write to a different register sometimes. Patch by Walter Erquinigo! llvm-svn: 280005
* Replace "fallthrough" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-171-2/+4
| | | | | | | This is a mechanical change of comments in switches like fallthrough, fall-through, or fall-thru to use the LLVM_FALLTHROUGH macro instead. llvm-svn: 278902
* [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.Lang Hames2016-08-017-7/+7
| | | | | | | | | | | | | | | | This patch replaces RuntimeDyld::SymbolInfo with JITSymbol: A symbol class that is capable of lazy materialization (i.e. the symbol definition needn't be emitted until the address is requested). This can be used to support common and weak symbols in the JIT (though this is not implemented in this patch). For consistency, RuntimeDyld::SymbolResolver is renamed to JITSymbolResolver. For space efficiency a new class, JITEvaluatedSymbol, is introduced that behaves like the old RuntimeDyld::SymbolInfo - i.e. it is just a pair of an address and symbol flags. Instances of JITEvaluatedSymbol can be used in symbol-tables to avoid paying the space cost of the materializer. llvm-svn: 277386
* X86: handle external tail calls in Windows JITSaleem Abdulrasool2016-07-141-2/+4
| | | | | | | | | | If there was a tail call, we would incorrectly handle the relocation. It would end up indexing into the array with an incorrect section id. The symbol was external to the module, so the Section ID was UNDEFINED (-1). We would then index the SmallVector with this ID, triggering an assertion. Use the Value rather than the section load address in this case. llvm-svn: 275442
* ExecutionEngine: silence unused value warningSaleem Abdulrasool2016-06-241-0/+3
| | | | | | | The Value is only used in debug or asserts builds. Just cast to void to silence an unused variable warning. llvm-svn: 273684
* ExecutionEngine: add preliminary support for COFF ARMSaleem Abdulrasool2016-06-241-0/+288
| | | | | | | | | This adds rudimentary support for COFF ARM to the dynamic loader for the exeuction engine. This can be used by lldb to JIT code into a COFF ARM environment. This lays the foundation for the loader, though a few of the relocation types are yet unhandled. llvm-svn: 273682
* [PATCH] Fix RuntimeDyldCOFFI386 to handle relocations with a non-zero addendReid Kleckner2016-06-161-3/+21
| | | | | | | | | This fixes IMAGE_REL_I386_DIR32, IMAGE_REL_I386_DIR32NB, IMAGE_REL_I386_SECREL, and IMAGE_REL_I386_REL32 relocations. Based on patch by Jon Turney <jon.turney@dronecode.org.uk> llvm-svn: 272911
* [RuntimeDyld][MachO] Add support for SUBTRACTOR relocations between anonymousLang Hames2016-05-191-15/+52
| | | | | | symbols on x86-64. llvm-svn: 270157
* [RuntimeDyld] Thread Error through some APIs, remove calls to ↵Lang Hames2016-05-184-58/+18
| | | | | | report_fatal_error. llvm-svn: 269881
* Thread Expected<...> up from libObject’s getType() for symbols to allow ↵Kevin Enderby2016-05-022-2/+18
| | | | | | | | | | | | | | | | | | | | | | llvm-objdump to produce a good error message. Produce another specific error message for a malformed Mach-O file when a symbol’s section index is more than the number of sections. The existing test case in test/Object/macho-invalid.test for macho-invalid-section-index-getSectionRawName now reports the error with the message indicating that a symbol at a specific index has a bad section index and that bad section index value. Again converting interfaces to Expected<> from ErrorOr<> does involve touching a number of places. Where the existing code reported the error with a string message or an error code it was converted to do the same. Also there some were bugs in the existing code that did not deal with the old ErrorOr<> return values.  So now with Expected<> since they must be checked and the error handled, I added a TODO and a comment: "// TODO: Actually report errors helpfully" and a call something like consumeError(NameOrErr.takeError()) so the buggy code will not crash since needed to deal with the Error. llvm-svn: 268298
* Use llvm:Twine instead of std::to_string.Chaoren Lin2016-04-283-11/+11
| | | | | | | | | | | | std::to_string is not available from the Android NDK. Reviewers: lhames, ovyalov, chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19638 llvm-svn: 267829
* [RuntimeDyld] Add missing include - <string> is requried for std::to_string.Lang Hames2016-04-273-0/+3
| | | | | | | This should fix the compile error that showed up in build: http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/6754/ llvm-svn: 267790
* [RuntimeDyld] Plumb Error/Expected through the internals of RuntimeDyld.Lang Hames2016-04-276-87/+153
| | | | | | | | | | | | | Also replaces a number of calls to report_fatal_error with Error returns. The plumbing will make it easier to return errors originating in libObject. Replacing report_fatal_errors with Error returns will give JIT clients the opportunity to recover gracefully when the JIT is unable to produce/relocate code, as well as providing meaningful error messages that can be used to file bug reports. llvm-svn: 267776
OpenPOWER on IntegriCloud