diff options
author | Petr Hosek <phosek@chromium.org> | 2018-01-08 02:48:41 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2018-01-08 02:48:41 +0000 |
commit | 66aea6eb98598560a5f5f945a32009af9f5c5e54 (patch) | |
tree | 2b89ec53861404b5581cb4844774b9fed960829c /llvm/test/lit.cfg.py | |
parent | b3f802265e048991c43fc004bf0645c7156fb83e (diff) | |
download | bcm5719-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
Diffstat (limited to 'llvm/test/lit.cfg.py')
-rw-r--r-- | llvm/test/lit.cfg.py | 30 |
1 files changed, 30 insertions, 0 deletions
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') |