[libcxx-commits] [libcxx] 203096a - [libcxx] [test] Include more libraries that normally are linked automatically

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 29 09:54:16 PDT 2021


Author: Martin Storsjö
Date: 2021-04-29T19:54:07+03:00
New Revision: 203096adfce36ed9fe212abd529ce51a8c4b4830

URL: https://github.com/llvm/llvm-project/commit/203096adfce36ed9fe212abd529ce51a8c4b4830
DIFF: https://github.com/llvm/llvm-project/commit/203096adfce36ed9fe212abd529ce51a8c4b4830.diff

LOG: [libcxx] [test] Include more libraries that normally are linked automatically

As the libcxx tests link with -nostdlib, libraries that normally
are added by default by the compiler driver has to be added
manually.

The "oldnames" library is automatically added when driving linking
with clang-cl. When linking with the plain clang driver, as the
libcxx tests do, the clang driver does the same but only since Clang
12.0). But when linking with -nostdlib, like the libcxx tests do,
the driver defaults aren't added at all, and we need to specify the
defaults manually.

This allows removing a TODO from the Windows CI setup; it turns out
that upgrading to Clang 12.0 didn't help here as expected, sorry about
that mixup.

Differential Revision: https://reviews.llvm.org/D101434

Added: 
    

Modified: 
    libcxx/utils/ci/run-buildbot
    libcxx/utils/libcxx/test/config.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 0cb7260665d70..1042b110f2bf7 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -483,12 +483,6 @@ generic-win)
     # when building tests) to allow enabling filesystem for running tests,
     # even if it uses a non-permanent ABI.
 
-    # TODO: The CI runner currently uses Clang 11, which doesn't implicitly
-    # link in oldnames.lib (which is needed for some tests) when compiling
-    # with the plain "clang" driver, as the tests do (as opposed to using
-    # the "clang-cl" driver for compiling). When the CI runner runs
-    # Clang 12, the "-loldnames" option can be dropped.
-
     # TODO: Currently, building with the experimental library breaks running
     # tests (the test linking look for the c++experimental library with the
     # wrong name, and the statically linked c++experimental can't be linked
@@ -507,8 +501,7 @@ generic-win)
           -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO \
           -DLIBCXX_ENABLE_FILESYSTEM=YES \
           -DCMAKE_CXX_FLAGS="-D_LIBCPP_HAS_NO_INT128" \
-          -DLIBCXX_TEST_COMPILER_FLAGS="-D_LIBCPP_HAS_NO_INT128" \
-          -DLIBCXX_TEST_LINKER_FLAGS="-loldnames"
+          -DLIBCXX_TEST_COMPILER_FLAGS="-D_LIBCPP_HAS_NO_INT128"
     echo "+++ Running the libc++ tests"
     ${NINJA} -vC "${BUILD_DIR}" check-cxx
 ;;

diff  --git a/libcxx/utils/libcxx/test/config.py b/libcxx/utils/libcxx/test/config.py
index 1410ab2eebfe1..7e32240b7f817 100644
--- a/libcxx/utils/libcxx/test/config.py
+++ b/libcxx/utils/libcxx/test/config.py
@@ -465,6 +465,9 @@ def configure_link_flags_abi_library(self):
             # libcxx CMakeLists.txt if building targeting msvc.
             self.cxx.link_flags += ['-l%s%s' % (lib, debug_suffix) for lib in
                                     ['vcruntime', 'ucrt', 'msvcrt', 'msvcprt']]
+            # The compiler normally links in oldnames.lib too, but we've
+            # specified -nostdlib above, so we need to specify it manually.
+            self.cxx.link_flags += ['-loldnames']
         elif cxx_abi == 'none' or cxx_abi == 'default':
             if self.target_info.is_windows():
                 debug_suffix = 'd' if self.debug_build else ''


        


More information about the libcxx-commits mailing list