diff options
| author | Petr Hosek <phosek@chromium.org> | 2019-02-05 19:50:47 +0000 |
|---|---|---|
| committer | Petr Hosek <phosek@chromium.org> | 2019-02-05 19:50:47 +0000 |
| commit | 97bc08ae02bf4b490abbe27ecb0ee6250892e1e2 (patch) | |
| tree | e8af37a17da79e58e863924dc59027143ff577fe | |
| parent | e2c5847414692024bf955de68e72f74fc1ea391e (diff) | |
| download | bcm5719-llvm-97bc08ae02bf4b490abbe27ecb0ee6250892e1e2.tar.gz bcm5719-llvm-97bc08ae02bf4b490abbe27ecb0ee6250892e1e2.zip | |
[CMake] Support compiler-rt builtins library in tests
We're building tests with -nostdlib which means that we need to
explicitly include the builtins library. When using libgcc (default)
we can simply include -lgcc_s on the link line, but when using
compiler-rt builtins we need a complete path to the builtins library.
This path is already available in CMake as <PROJECT>_BUILTINS_LIBRARY,
so we just need to pass that path to lit and if config.compiler_rt is
true, link it to the test.
Prior to this patch, running tests when compiler-rt is being used as
the builtins library was broken as all tests would fail to link, but
with this change running tests when compiler-rt bultins library is
being used should be supported.
Differential Revision: https://reviews.llvm.org/D56701
llvm-svn: 353208
| -rw-r--r-- | libcxx/docs/TestingLibcxx.rst | 8 | ||||
| -rw-r--r-- | libcxx/test/lit.site.cfg.in | 2 | ||||
| -rw-r--r-- | libcxx/utils/libcxx/test/target_info.py | 6 | ||||
| -rw-r--r-- | libcxxabi/test/lit.site.cfg.in | 2 | ||||
| -rw-r--r-- | libunwind/test/lit.site.cfg.in | 2 |
5 files changed, 15 insertions, 5 deletions
diff --git a/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst index ebbbf628ac0..d8060fed1f1 100644 --- a/libcxx/docs/TestingLibcxx.rst +++ b/libcxx/docs/TestingLibcxx.rst @@ -183,6 +183,14 @@ configuration. Passing the option on the command line will override the default. option is specified or the environment variable LIBCXX_COLOR_DIAGNOSTICS is present then color diagnostics will be enabled. +.. option:: llvm_unwinder + + Enable the use of LLVM unwinder instead of libgcc. + +.. option:: builtins_library + + Path to the builtins library to use instead of libgcc. + Environment Variables --------------------- diff --git a/libcxx/test/lit.site.cfg.in b/libcxx/test/lit.site.cfg.in index 019cca8a27d..ed9a711056d 100644 --- a/libcxx/test/lit.site.cfg.in +++ b/libcxx/test/lit.site.cfg.in @@ -27,7 +27,7 @@ config.test_compiler_flags = "@LIBCXX_TEST_COMPILER_FLAGS@" config.executor = "@LIBCXX_EXECUTOR@" config.llvm_unwinder = @LIBCXXABI_USE_LLVM_UNWINDER@ -config.compiler_rt = @LIBCXX_USE_COMPILER_RT@ +config.builtins_library = "@LIBCXX_BUILTINS_LIBRARY@" config.has_libatomic = @LIBCXX_HAS_ATOMIC_LIB@ config.use_libatomic = @LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@ config.debug_build = @LIBCXX_DEBUG_BUILD@ diff --git a/libcxx/utils/libcxx/test/target_info.py b/libcxx/utils/libcxx/test/target_info.py index fb450805f27..2ea24d62ebc 100644 --- a/libcxx/utils/libcxx/test/target_info.py +++ b/libcxx/utils/libcxx/test/target_info.py @@ -251,8 +251,10 @@ class LinuxLocalTI(DefaultTargetInfo): flags += ['-lunwind', '-ldl'] else: flags += ['-lgcc_s'] - compiler_rt = self.full_config.get_lit_bool('compiler_rt', False) - if not compiler_rt: + builtins_lib = self.full_config.get_lit_conf('builtins_library') + if builtins_lib: + flags += [builtins_lib] + else: flags += ['-lgcc'] use_libatomic = self.full_config.get_lit_bool('use_libatomic', False) if use_libatomic: diff --git a/libcxxabi/test/lit.site.cfg.in b/libcxxabi/test/lit.site.cfg.in index a4c5764f6b4..4abb8edeea0 100644 --- a/libcxxabi/test/lit.site.cfg.in +++ b/libcxxabi/test/lit.site.cfg.in @@ -9,7 +9,7 @@ config.cxx_headers = "@LIBCXXABI_LIBCXX_INCLUDES@" config.libunwind_headers = "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@" config.cxx_library_root = "@LIBCXXABI_LIBCXX_LIBRARY_PATH@" config.llvm_unwinder = @LIBCXXABI_USE_LLVM_UNWINDER@ -config.compiler_rt = @LIBCXXABI_USE_COMPILER_RT@ +config.builtins_library = "@LIBCXXABI_BUILTINS_LIBRARY@" config.enable_threads = @LIBCXXABI_ENABLE_THREADS@ config.use_sanitizer = "@LLVM_USE_SANITIZER@" config.sanitizer_library = "@LIBCXXABI_SANITIZER_LIBRARY@" diff --git a/libunwind/test/lit.site.cfg.in b/libunwind/test/lit.site.cfg.in index 4b4cb7e6ca3..34da72ac106 100644 --- a/libunwind/test/lit.site.cfg.in +++ b/libunwind/test/lit.site.cfg.in @@ -8,7 +8,7 @@ config.libcxx_src_root = "@LIBUNWIND_LIBCXX_PATH@" config.libunwind_headers = "@LIBUNWIND_SOURCE_DIR@/include" config.cxx_library_root = "@LIBUNWIND_LIBCXX_LIBRARY_PATH@" config.llvm_unwinder = True -config.compiler_rt = @LIBUNWIND_USE_COMPILER_RT@ +config.builtins_library = "@LIBUNWIND_BUILTINS_LIBRARY@" config.enable_threads = @LIBUNWIND_ENABLE_THREADS@ config.use_sanitizer = "@LLVM_USE_SANITIZER@" config.enable_32bit = @LIBUNWIND_BUILD_32_BITS@ |

