[llvm] r321981 - Don't try to run MCJIT/OrcJIT EH tests when C++ library is statically linked
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 7 18:48:41 PST 2018
Author: phosek
Date: Sun Jan 7 18:48:41 2018
New Revision: 321981
URL: http://llvm.org/viewvc/llvm-project?rev=321981&view=rev
Log:
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
Modified:
llvm/trunk/test/ExecutionEngine/MCJIT/eh-lg-pic.ll
llvm/trunk/test/ExecutionEngine/MCJIT/eh.ll
llvm/trunk/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll
llvm/trunk/test/ExecutionEngine/MCJIT/remote/eh.ll
llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh.ll
llvm/trunk/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll
llvm/trunk/test/ExecutionEngine/OrcMCJIT/remote/eh.ll
llvm/trunk/test/lit.cfg.py
Modified: llvm/trunk/test/ExecutionEngine/MCJIT/eh-lg-pic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/eh-lg-pic.ll?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/eh-lg-pic.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/eh-lg-pic.ll Sun Jan 7 18:48:41 2018
@@ -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)
Modified: llvm/trunk/test/ExecutionEngine/MCJIT/eh.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/eh.ll?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/eh.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/eh.ll Sun Jan 7 18:48:41 2018
@@ -1,3 +1,4 @@
+; REQUIRES: cxx-shared-library
; RUN: %lli %s
; XFAIL: arm, cygwin, win32, mingw
declare i8* @__cxa_allocate_exception(i64)
Modified: llvm/trunk/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll Sun Jan 7 18:48:41 2018
@@ -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)
Modified: llvm/trunk/test/ExecutionEngine/MCJIT/remote/eh.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/MCJIT/remote/eh.ll?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/MCJIT/remote/eh.ll (original)
+++ llvm/trunk/test/ExecutionEngine/MCJIT/remote/eh.ll Sun Jan 7 18:48:41 2018
@@ -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
Modified: llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll (original)
+++ llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll Sun Jan 7 18:48:41 2018
@@ -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)
Modified: llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh.ll?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh.ll (original)
+++ llvm/trunk/test/ExecutionEngine/OrcMCJIT/eh.ll Sun Jan 7 18:48:41 2018
@@ -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)
Modified: llvm/trunk/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll (original)
+++ llvm/trunk/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll Sun Jan 7 18:48:41 2018
@@ -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)
Modified: llvm/trunk/test/ExecutionEngine/OrcMCJIT/remote/eh.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/OrcMCJIT/remote/eh.ll?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/ExecutionEngine/OrcMCJIT/remote/eh.ll (original)
+++ llvm/trunk/test/ExecutionEngine/OrcMCJIT/remote/eh.ll Sun Jan 7 18:48:41 2018
@@ -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
Modified: llvm/trunk/test/lit.cfg.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lit.cfg.py?rev=321981&r1=321980&r2=321981&view=diff
==============================================================================
--- llvm/trunk/test/lit.cfg.py (original)
+++ llvm/trunk/test/lit.cfg.py Sun Jan 7 18:48:41 2018
@@ -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')
More information about the llvm-commits
mailing list