summaryrefslogtreecommitdiffstats
path: root/llvm/test/ExecutionEngine
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2017-05-23 14:51:18 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2017-05-23 14:51:18 +0000
commit7f02d67fce456a0873449989064f888df992f671 (patch)
treedb130b2c18523b39bac50ab9fb48ceee23e25c87 /llvm/test/ExecutionEngine
parent9bab8eab49e2b9179a475c03d687bd2a896a0e02 (diff)
downloadbcm5719-llvm-7f02d67fce456a0873449989064f888df992f671.tar.gz
bcm5719-llvm-7f02d67fce456a0873449989064f888df992f671.zip
[RuntimeDyld, PowerPC] Fix check for external symbols when detecting 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
Diffstat (limited to 'llvm/test/ExecutionEngine')
-rw-r--r--llvm/test/ExecutionEngine/MCJIT/lit.local.cfg3
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/lit.local.cfg3
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/pr32650.ll28
3 files changed, 32 insertions, 2 deletions
diff --git a/llvm/test/ExecutionEngine/MCJIT/lit.local.cfg b/llvm/test/ExecutionEngine/MCJIT/lit.local.cfg
index f9814035773..e2535ef1dbf 100644
--- a/llvm/test/ExecutionEngine/MCJIT/lit.local.cfg
+++ b/llvm/test/ExecutionEngine/MCJIT/lit.local.cfg
@@ -9,7 +9,8 @@ else:
# FIXME: autoconf and cmake produce different arch names. We should normalize
# them before getting here.
if root.host_arch not in ['i386', 'x86', 'x86_64', 'AMD64',
- 'AArch64', 'ARM', 'Mips', 'PowerPC', 'ppc64', 'SystemZ']:
+ 'AArch64', 'ARM', 'Mips',
+ 'PowerPC', 'ppc64', 'ppc64le', 'SystemZ']:
config.unsupported = True
if 'armv7' in root.host_arch:
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/lit.local.cfg b/llvm/test/ExecutionEngine/OrcMCJIT/lit.local.cfg
index f9814035773..e2535ef1dbf 100644
--- a/llvm/test/ExecutionEngine/OrcMCJIT/lit.local.cfg
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/lit.local.cfg
@@ -9,7 +9,8 @@ else:
# FIXME: autoconf and cmake produce different arch names. We should normalize
# them before getting here.
if root.host_arch not in ['i386', 'x86', 'x86_64', 'AMD64',
- 'AArch64', 'ARM', 'Mips', 'PowerPC', 'ppc64', 'SystemZ']:
+ 'AArch64', 'ARM', 'Mips',
+ 'PowerPC', 'ppc64', 'ppc64le', 'SystemZ']:
config.unsupported = True
if 'armv7' in root.host_arch:
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/pr32650.ll b/llvm/test/ExecutionEngine/OrcMCJIT/pr32650.ll
new file mode 100644
index 00000000000..bbf68aea512
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/pr32650.ll
@@ -0,0 +1,28 @@
+; RUN: %lli -jit-kind=orc-mcjit %s
+
+; This test is intended to verify that a function weakly defined in
+; JITted code, and strongly defined in the main executable, can be
+; correctly resolved when called from elsewhere in JITted code.
+
+; This test makes the assumption that the lli executable in compiled
+; to export symbols (e.g. --export-dynamic), and that is actually does
+; contain the symbol LLVMInitializeCodeGen. (Note that this function
+; is not actually called by the test. The test simply verifes that
+; the reference can be resolved without relocation errors.)
+
+define linkonce_odr void @LLVMInitializeCodeGen() {
+entry:
+ ret void
+}
+
+define void @test() {
+entry:
+ call void @LLVMInitializeCodeGen()
+ ret void
+}
+
+define i32 @main() {
+entry:
+ ret i32 0
+}
+
OpenPOWER on IntegriCloud