[libcxx-commits] [libcxx] r353208 - [CMake] Support compiler-rt builtins library in tests
Petr Hosek via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 5 11:50:48 PST 2019
Author: phosek
Date: Tue Feb 5 11:50:47 2019
New Revision: 353208
URL: http://llvm.org/viewvc/llvm-project?rev=353208&view=rev
Log:
[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
Modified:
libcxx/trunk/docs/TestingLibcxx.rst
libcxx/trunk/test/lit.site.cfg.in
libcxx/trunk/utils/libcxx/test/target_info.py
Modified: libcxx/trunk/docs/TestingLibcxx.rst
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/TestingLibcxx.rst?rev=353208&r1=353207&r2=353208&view=diff
==============================================================================
--- libcxx/trunk/docs/TestingLibcxx.rst (original)
+++ libcxx/trunk/docs/TestingLibcxx.rst Tue Feb 5 11:50:47 2019
@@ -183,6 +183,14 @@ configuration. Passing the option on the
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
---------------------
Modified: libcxx/trunk/test/lit.site.cfg.in
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/lit.site.cfg.in?rev=353208&r1=353207&r2=353208&view=diff
==============================================================================
--- libcxx/trunk/test/lit.site.cfg.in (original)
+++ libcxx/trunk/test/lit.site.cfg.in Tue Feb 5 11:50:47 2019
@@ -27,7 +27,7 @@ config.test_compiler_flags = "@LIBC
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@
Modified: libcxx/trunk/utils/libcxx/test/target_info.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/target_info.py?rev=353208&r1=353207&r2=353208&view=diff
==============================================================================
--- libcxx/trunk/utils/libcxx/test/target_info.py (original)
+++ libcxx/trunk/utils/libcxx/test/target_info.py Tue Feb 5 11:50:47 2019
@@ -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:
More information about the libcxx-commits
mailing list