Commit Graph

438 Commits

Author SHA1 Message Date
Eugene Leviant
2d0a1dd417 RuntimeDyldELF: implement R_AARCH64_PREL64 reloc
Differential revision: https://reviews.llvm.org/D28122


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291558 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-10 11:05:30 +00:00
Eugene Leviant
9be988aa91 RuntimeDyldELF: add missing test cases for AArch64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291438 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 11:47:33 +00:00
Eugene Leviant
0f4cbb99e9 RuntimeDyldELF: don't create thunk if not needed
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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291431 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-09 09:56:31 +00:00
Michal Gorny
1159e42199 [cmake] Canonicalize CMake booleans to 0/1 for lit interop
Canonicalize all CMake booleans to 0/1 before passing them to lit, to
ensure that the Python side handles all of them consistently
and correctly. 0/1 is a safe choice of values that trigger the same
boolean interpretation in CMake, Python and C++.

Furthermore, using them without quotes improves the chance Python will
explicitly fail when an incorrect value (such as ON/OFF, TRUE/FALSE,
YES/NO) is accidentally passed, rather than silently misinterpreting
the value.

This replaces a lot of different logics spread around lit site files,
attempting to partially reproduce the boolean logic used in CMake
and usually silently failing when an uncommon value was used instead.
In fact, some of them were never working correctly since different
values were assigned in CMake and checked in Python.

The alternative solution could be to create a common parser for CMake
booleans in lit and use it consistently throughout the site files.
However, it does not seem like the best idea to create redundant
implementation of the same logic and have to follow upstream if it ever
is extended to handle more values.

Differential Revision: https://reviews.llvm.org/D28294

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291284 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 21:33:48 +00:00
Eugene Leviant
9b804c5b0a RuntimeDyldELF: add R_AARCH64_ADD_ABS_LO12_NC reloc
Differential revision: https://reviews.llvm.org/D28115


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290598 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-27 09:51:38 +00:00
Yichao Yu
e012a3d747 Fix R_AARCH64_MOVW_UABS_G3 relocation
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289880 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-15 22:36:53 +00:00
Davide Italiano
8eb98effd1 Make this test Windows-only (try to placate buildbots).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285931 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-03 16:43:10 +00:00
Davide Italiano
fade6c26a0 [RuntimeDyld] Move an X86 only test to the correct directory.
This is an attempt to placate the bots after r285841.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285859 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-02 21:05:42 +00:00
Davide Italiano
74a715d8bc [lli/COFF] Set the correct alignment for common symbols
Otherwise we set it always to zero, which is not correct,
and we assert inside alignTo (Assertion failed:
Align != 0u && "Align can't be 0.").

Differential Revision:  https://reviews.llvm.org/D26173

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285841 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-02 17:32:19 +00:00
Keno Fischer
a5f79d9770 Fix PREL31 relocation on ARM
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284780 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 21:15:29 +00:00
Simon Dardis
f7463aa366 [mips][mcjit] Add the majority of N32 support.
The missing piece is relocation composition for %hi(%neg(%gp_rel(x))) and
similar.

Patch by: Daniel Sanders


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284724 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-20 13:02:23 +00:00
Lang Hames
599a7aa9a7 Remove the JIT EH/small code model tests for now.
These tests rely on two sections being allocated with a limited displacement
from one to the other to work. We've never guaranteed this, and consequently
these tests usually fail. That led to them being XFAILed, but now they XPASS
whenever the sections do happen to be allocated nearby in memory. So I'm
removing these for now to get rid of the noise. We can re-instate them if/when
we take the time to implement a displacement-respecting allocator.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284654 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-19 22:19:38 +00:00
Walter Erquinigo
f68eeb3359 Handle relocations to thumb functions when dynamic linking COFF modules
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284410 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-17 18:56:18 +00:00
Lang Hames
b80c6300c5 [ORC] Clone module flags metadata into the globals module in the
CompileOnDemandLayer.

Also contains a tweak to the orc-lazy jit in LLI to enable the test case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280632 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-04 17:53:30 +00:00
Saleem Abdulrasool
294618592b ExecutionEngine: fix a bug in the movt/movw relocator
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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280005 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-29 20:42:03 +00:00
Lang Hames
472f1cbd1f [RuntimeDyld] Revert r279182 and 279201 -- they broke some ARM bots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279275 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 17:06:39 +00:00
Lang Hames
d9176f9ab2 [RuntimeDyld][MCJIT] Un-XFAIL some tests that were fixed by r279182.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279201 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-19 03:12:16 +00:00
Lang Hames
d5ab2f8e97 [ExecutionEngine] Disable weak symbol tests for COFF.
COFF doesn't support weak linkage on functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278162 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09 20:48:22 +00:00
Lang Hames
04d404bad2 Re-apply r278065 (Weak symbol support in RuntimeDyld) with a fix for ELF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278149 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-09 19:27:17 +00:00
Lang Hames
06c9df2f1c Revert r278065 while I investigate some build-bot breakage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278069 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08 22:57:30 +00:00
Lang Hames
fbda7015e7 [RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.
This patch causes RuntimeDyld to check for existing definitions when it
encounters weak symbols. If a definition already exists then the new weak
definition is discarded. All symbol lookups within a "logical dylib" should now
agree on the address of any given weak symbol. This allows the JIT to better
match the behavior of the static linker for C++ code.

This support is only partial, as it does not allow strong definitions that
occur after the first weak definition (in JIT symbol lookup order) to override
the previous weak definitions. Support for this will be added in a future
patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278065 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-08 22:53:37 +00:00
Lang Hames
9350f3619a [ORC] Re-apply r277896, removing bogus triples and datalayouts that broke tests
on linux last time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277942 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 22:36:26 +00:00
Nico Weber
84f6a48c0d Revert r277896.
It breaks ExecutionEngine/OrcLazy/weak-function.ll on most bots.

Script:
--
...
--
Exit Code: 1

Command Output (stderr):
--
Could not find main function.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277907 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 02:00:45 +00:00
Lang Hames
38365dac94 [ORC] Add (partial) weak symbol support to the CompileOnDemand layer.
This adds partial support for weak functions to the CompileOnDemandLayer by
modifying the addLogicalModule method to check for existing stub definitions
before building a new stub for a weak function. This scheme is sufficient to
support ODR definitions, but fails for general weak definitions if strong
definition is encountered after the first weak definition. (A more extensive
refactor will be required to fully support weak symbols).

This patch does *not* add weak symbol support to RuntimeDyld: I hope to add
that in the near future.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277896 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-06 00:54:43 +00:00
Lang Hames
f4cfadb9c0 [Orc] Fix common symbol support in ORC.
Common symbol support in ORC was broken in r270716 when the symbol resolution
rules in RuntimeDyld were changed. With the switch to lazily materialized
symbols in r277386, common symbols can be supported by having
RuntimeDyld::emitCommonSymbols search for (but not materialize!) definitions
elsewhere in the logical dylib.

This patch adds the 'Common' flag to JITSymbolFlags, and the necessary check
to RuntimeDyld::emitCommonSymbols.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277397 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 22:23:24 +00:00
Saleem Abdulrasool
4d45f1ed0d X86: handle external tail calls in Windows JIT
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-14 17:27:06 +00:00
Saleem Abdulrasool
7fb006603a ExecutionEngine: add preliminary support for COFF ARM
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273682 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-24 14:11:44 +00:00
Rafael Espindola
3be11e69ac Change the default of -relax-relocations.
llvm-mc is a developer tool, as such it make sense for it to use new
features by default.

This doesn't change the user facing clang, which still defaults to non
relaxable relocations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273014 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-17 17:04:56 +00:00
Reid Kleckner
71b1fedfef [PATCH] Fix RuntimeDyldCOFFI386 to handle relocations with a non-zero addend
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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272911 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-16 16:21:41 +00:00
Sagar Thakur
805f1b70c4 [MIPS][LLVM-MC] Fix Disassemble of Negative Offset
Patch by Nitesh Jain.

Summary: The type of Imm in MipsDisassembler.cpp was incorrect since SignExtend64 return int64_t type.As per the MIPSr6 doc ,the offset is added to the address of the instruction following the branch (not the branch itself), to form a PC-relative effective target address hence “4” is added to the offset. The offset of some test case are update to reflect the changes due to “ + 4 ” offset and new test case for negative offset are added.

Reviewers: dsanders, vkalintiris
Differential Revision: http://reviews.llvm.org/D17540


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270542 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-24 09:57:10 +00:00
Lang Hames
8c34a3f83c [RuntimeDyld][MachO] Add support for SUBTRACTOR relocations between anonymous
symbols on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270157 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-19 23:26:05 +00:00
Rafael Espindola
214e8d3f06 Don't pass relocation-model= to tests that don't need it.
Very few things in MC itself use the option. Most of the code that that
uses it could be move to CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269871 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 00:27:17 +00:00
Steven Wu
1c60c02881 Disable test from r269436 on unsupported platforms
Fixing bots failure. test/ExecutionEngine/RuntimeDyld/SystemZ/cfi-relo-pc64.s
requires SystemZ backend. Mark the test as unsupported if the backend is not
available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269470 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 20:10:51 +00:00
Bryan Chan
d80276dc1b [RuntimeDyld] Support R_390_PC64 relocation type
Summary: When the MCJIT generates ELF code, some DWARF data requires 64-bit PC-relative relocation (R_390_PC64). This patch adds support for R_390_PC64 relocation to RuntimeDyld::resolveSystemZRelocation, to avoid an assertion failure.

Reviewers: uweigand

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20033

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-13 17:23:48 +00:00
Bill Seurer
edae2f4f96 [powerpc] mark JIT tests as UNSUPPORTED on powerpc64 big endian
Some of the JIT tests began failing with "[llvm] r266663 - [Orc] Re-commit 
r266581 with fixes for MSVC, and format cleanups." on powerpc64 big endian.  
To get the buildbots running I am marking these as UNSUPPORTED for now.

If this is fixed remove the UNSUPPORTED flag "powerpc64-unknown-linux-gnu".

In r267516 I marked these as XFAIL but they succeed on some of the bots
on stage1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267518 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 03:59:19 +00:00
Bill Seurer
8ee491358a [powerpc] mark JIT tests as XFAIL on powerpc64 big endian
Some of the JIT tests began failing with "[llvm] r266663 - [Orc] Re-commit 
r266581 with fixes for MSVC, and format cleanups." on powerpc64 big endian.  
To get the buildbots running I am marking these as XFAIL for now.

If this is fixed remove the XFAIL flag "powerpc64-unknown-linux-gnu".



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267516 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-26 02:33:22 +00:00
Davide Italiano
b50e1f0066 [RuntimeDyldELF] Handle GOTPCRELX/REX_GOTPCRELX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-24 01:36:37 +00:00
Reid Kleckner
952c84f10b Disable the new Orc lazy JIT tests on Windows, they do not pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260405 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 18:46:42 +00:00
Lang Hames
db7e3d1e5c [Orc] Add lazy-JITting support for i386.
This patch adds a new class, OrcI386, which contains the hooks needed to
support lazy-JITing on i386 (currently only for Pentium 2 or above, as the JIT
re-entry code uses the FXSAVE/FXRSTOR instructions).

Support for i386 is enabled in the LLI lazy JIT and the Orc C API, and
regression and unit tests are enabled for this architecture.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260338 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 01:02:33 +00:00
Lang Hames
88ffce3c57 [RuntimeDyld][MachO] Fix handling of empty eh-frame sections.
This patch switches from an unguarded to a guarded loop for eh-frame record
fixups. In the unguarded version we would always make at least one call to
processFDE, which would then crash trying to fix up a frame that didn't exist.

Fixes <rdar://problem/24301582>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259103 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-28 22:35:48 +00:00
Lang Hames
1a9ebde7e0 [RuntimeDyld][AArch64] Add support for the MachO ARM64_RELOC_SUBTRACTOR reloc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258438 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-21 21:59:50 +00:00
Davide Italiano
081edeca2f [JIT] Add small-code model test for ELF.
The coverage is almost non-existent, hopefully more will come after this.

Differential Revision:	http://reviews.llvm.org/D16096


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258087 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-18 21:14:12 +00:00
Lang Hames
94e1407bce Remove some stale comments and fix a typo as suggested by David Blaikie in his
review of r257343.

Thanks Dave!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258002 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-17 01:49:46 +00:00
Lang Hames
f881fc9fb9 [Orc] Add support for EH-frame registration to the Orc Remote Target utility
classes.

OrcRemoteTargetClient::RCMemoryManager will now register EH frames with the
server automatically. This allows remote-execution of code that uses exceptions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257816 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 22:02:03 +00:00
NAKAMURA Takumi
e9382fe577 Mark remote-JIT tests as XFAIL, as well as win32, for targeting mingw32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257732 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 01:33:00 +00:00
Lang Hames
6a7de42ac6 [Orc] XFAIL a few remote-jit test cases that I missed in r257391.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257419 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 23:57:39 +00:00
Lang Hames
7ab54fc926 XFAIL the LLI remote JIT tests on Win32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257391 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 21:41:34 +00:00
Lang Hames
c6eb1a443f Remove the remote-JIT small code model tests for now. They're causing
intermittent XPASSes on some builders.

These can be reinstated when we have proper support for small-code model in
the JIT.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257359 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 17:38:25 +00:00
Lang Hames
a769f56ac5 XFAIL the remote small code model tests on x86. Small code model is not properly
supported, and only worked previously because we weren't really running them
out-of-process.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257355 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 17:09:58 +00:00
Lang Hames
b20e09ca99 [LLI] Replace the LLI remote-JIT support with the new ORC remote-JIT components.
The new ORC remote-JITing support provides a superset of the old code's
functionality, so we can replace the old stuff. As a bonus, a couple of
previously XFAILed tests have started passing.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257343 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-11 16:35:55 +00:00