diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -240,6 +240,14 @@ if not config.build_shared_libs and not config.link_llvm_dylib: config.available_features.add('static-libs') +if config.link_llvm_dylib: + config.available_features.add('llvm-dylib') + config.substitutions.append( + ('%llvmdylib', + '{}/libLLVM-{}{}'.format(config.llvm_shlib_dir, + config.llvm_dylib_version, + config.llvm_shlib_ext))) + if config.have_tf_aot: config.available_features.add("have_tf_aot") diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in --- a/llvm/test/lit.site.cfg.py.in +++ b/llvm/test/lit.site.cfg.py.in @@ -45,6 +45,7 @@ config.enable_threads = @LLVM_ENABLE_THREADS@ config.build_shared_libs = @BUILD_SHARED_LIBS@ config.link_llvm_dylib = @LLVM_LINK_LLVM_DYLIB@ +config.llvm_dylib_version = "@LLVM_VERSION_MAJOR@@LLVM_VERSION_SUFFIX@" config.llvm_host_triple = '@LLVM_HOST_TRIPLE@' config.host_arch = "@HOST_ARCH@" config.have_opt_viewer_modules = @LLVM_HAVE_OPT_VIEWER_MODULES@ diff --git a/llvm/test/tools/llvm-shlib/typeids.test b/llvm/test/tools/llvm-shlib/typeids.test new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-shlib/typeids.test @@ -0,0 +1,14 @@ +# REQUIRES: x86_64-linux, llvm-dylib + +# Make sure there's no llvm::Any::TypeId symbol local to the shared library. As +# the adress of llvm::Any::TypeId::Id is used as a global unique identifier for +# each type, having another visibility defeats the original purpose. +# +# This happens when llvm::Any::TypeId is parametrized by a type with hidden +# visibility. + +# RUN: llvm-nm -C %llvmdylib | FileCheck %s +# RUN: llvm-nm -C %llvmdylib | FileCheck %s --check-prefix=SAFETY-CHECK + +# CHECK-NOT: {{[^V]}} llvm::Any::TypeId +# SAFETY-CHECK: V llvm::Any::TypeId