summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2018-01-08 02:48:41 +0000
committerPetr Hosek <phosek@chromium.org>2018-01-08 02:48:41 +0000
commit66aea6eb98598560a5f5f945a32009af9f5c5e54 (patch)
tree2b89ec53861404b5581cb4844774b9fed960829c
parentb3f802265e048991c43fc004bf0645c7156fb83e (diff)
downloadbcm5719-llvm-66aea6eb98598560a5f5f945a32009af9f5c5e54.tar.gz
bcm5719-llvm-66aea6eb98598560a5f5f945a32009af9f5c5e54.zip
Don't try to run MCJIT/OrcJIT EH tests when C++ library is statically linked
These tests assumes availability of external symbols provided by the C++ library, but those won't be available in case when the C++ library is statically linked because lli itself doesn't need these. This uses llvm-readobj -needed-libs to check if C++ library is linked as shared library and exposes that information as a feature to lit. Differential Revision: https://reviews.llvm.org/D41272 llvm-svn: 321981
-rw-r--r--llvm/test/ExecutionEngine/MCJIT/eh-lg-pic.ll1
-rw-r--r--llvm/test/ExecutionEngine/MCJIT/eh.ll1
-rw-r--r--llvm/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll1
-rw-r--r--llvm/test/ExecutionEngine/MCJIT/remote/eh.ll1
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll1
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/eh.ll1
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll1
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/eh.ll1
-rw-r--r--llvm/test/lit.cfg.py30
9 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/ExecutionEngine/MCJIT/eh-lg-pic.ll b/llvm/test/ExecutionEngine/MCJIT/eh-lg-pic.ll
index 27c13e75e93..b5b9d5409c5 100644
--- a/llvm/test/ExecutionEngine/MCJIT/eh-lg-pic.ll
+++ b/llvm/test/ExecutionEngine/MCJIT/eh-lg-pic.ll
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli -relocation-model=pic -code-model=large %s
; XFAIL: cygwin, win32, mingw, mips-, mipsel-, i686, i386, aarch64, arm
declare i8* @__cxa_allocate_exception(i64)
diff --git a/llvm/test/ExecutionEngine/MCJIT/eh.ll b/llvm/test/ExecutionEngine/MCJIT/eh.ll
index ed057e14512..878a5db7edd 100644
--- a/llvm/test/ExecutionEngine/MCJIT/eh.ll
+++ b/llvm/test/ExecutionEngine/MCJIT/eh.ll
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli %s
; XFAIL: arm, cygwin, win32, mingw
declare i8* @__cxa_allocate_exception(i64)
diff --git a/llvm/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll b/llvm/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll
index 5c15ba4f15a..53fabe5daea 100644
--- a/llvm/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll
+++ b/llvm/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli -extra-module=%p/Inputs/multi-module-eh-b.ll %s
; XFAIL: arm, cygwin, win32, mingw
declare i8* @__cxa_allocate_exception(i64)
diff --git a/llvm/test/ExecutionEngine/MCJIT/remote/eh.ll b/llvm/test/ExecutionEngine/MCJIT/remote/eh.ll
index c4801d63033..c999140e51f 100644
--- a/llvm/test/ExecutionEngine/MCJIT/remote/eh.ll
+++ b/llvm/test/ExecutionEngine/MCJIT/remote/eh.ll
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s
; XFAIL: arm, cygwin, win32, mingw
; UNSUPPORTED: powerpc64-unknown-linux-gnu
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
index 3c05a710509..809f68ff3f9 100644
--- a/llvm/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli -jit-kind=orc-mcjit -relocation-model=pic -code-model=large %s
; XFAIL: cygwin, win32, mingw, mips-, mipsel-, i686, i386, aarch64, arm
declare i8* @__cxa_allocate_exception(i64)
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/eh.ll b/llvm/test/ExecutionEngine/OrcMCJIT/eh.ll
index 6b7ee69255d..b819f870890 100644
--- a/llvm/test/ExecutionEngine/OrcMCJIT/eh.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/eh.ll
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli -jit-kind=orc-mcjit %s
; XFAIL: arm, cygwin, win32, mingw
declare i8* @__cxa_allocate_exception(i64)
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll
index d3f9dd1a233..94648b3c1d3 100644
--- a/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/multi-module-eh-b.ll %s
; XFAIL: arm, cygwin, win32, mingw
declare i8* @__cxa_allocate_exception(i64)
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/remote/eh.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/eh.ll
index c4801d63033..c999140e51f 100644
--- a/llvm/test/ExecutionEngine/OrcMCJIT/remote/eh.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/eh.ll
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s
; XFAIL: arm, cygwin, win32, mingw
; UNSUPPORTED: powerpc64-unknown-linux-gnu
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 06a23536a8c..461dca6b364 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -194,6 +194,36 @@ if loadable_module:
if not config.build_shared_libs and not config.link_llvm_dylib:
config.available_features.add('static-libs')
+def have_cxx_shared_library():
+ readobj_exe = lit.util.which('llvm-readobj', config.llvm_tools_dir)
+ if not readobj_exe:
+ print('llvm-readobj not found')
+ return False
+
+ try:
+ readobj_cmd = subprocess.Popen(
+ [readobj_exe, '-needed-libs', readobj_exe], stdout=subprocess.PIPE)
+ except OSError:
+ print('could not exec llvm-readobj')
+ return False
+
+ readobj_out = readobj_cmd.stdout.read().decode('ascii')
+ readobj_cmd.wait()
+
+ regex = re.compile(r'(libc\+\+|libstdc\+\+|msvcp).*\.(so|dylib|dll)')
+ needed_libs = False
+ for line in readobj_out.splitlines():
+ if 'NeededLibraries [' in line:
+ needed_libs = True
+ if ']' in line:
+ needed_libs = False
+ if needed_libs and regex.search(line.lower()):
+ return True
+ return False
+
+if have_cxx_shared_library():
+ config.available_features.add('cxx-shared-library')
+
# Direct object generation
if not 'hexagon' in config.target_triple:
config.available_features.add('object-emission')
OpenPOWER on IntegriCloud