[PATCH] D62279: Use LTO capable linker

Wink Saville via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 11:52:13 PDT 2019


winksaville added a comment.

> Are you still having that issue after rL361436 <https://reviews.llvm.org/rL361436>? That should have resolved that problem. The issue isn't that gtest is missing from the bootstrap, but rather that it was missing from the dependencies for the runtime libraries.

Yes, that patch was/is in my master when it failed above <https://reviews.llvm.org/D62279#1514046>:

  $ git log -1 -p ed0036796164b3a2a93be8e2707984f57ba94e24
  commit ed0036796164b3a2a93be8e2707984f57ba94e24
  Author: Chris Bieneman <chris.bieneman at me.com>
  Date:   Wed May 22 21:42:06 2019 +0000
  
      [Runtimes] If LLVM_INCLUDE_TESTS=On depend on gtest
      
      Summary: If we are building the tests for the runtimes we should make them depend on gtest so that gtest is built and ready before we run any of the check-* targets.
      
      Reviewers: phosek, compnerd
      
      Reviewed By: compnerd
      
      Subscribers: mgorny, winksaville, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D62269
      
      llvm-svn: 361436
  
  diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
  index 7bbf0cf26a5..285e1fcae1d 100644
  --- a/llvm/runtimes/CMakeLists.txt
  +++ b/llvm/runtimes/CMakeLists.txt
  @@ -553,6 +553,8 @@ else() # if this is included from LLVM's CMake
             obj2yaml
             sancov
             sanstats
  +          gtest_main
  +          gtest
           )
         foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
           add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})

My master is at 74eb76f6 <https://reviews.llvm.org/rG74eb76f6c31e13551269f711cfccceca92b45783>:

  wink at wink-desktop:~/prgs/llvm/llvm-project (Use-LTO-capable-linker-and-add-libcxxabi)
  $ git log -1 master
  commit 74eb76f6c31e13551269f711cfccceca92b45783 (upstream/master, origin/master, origin/HEAD, master)
  Author: Alex Langford <apl at fb.com>
  Date:   Wed May 22 23:01:18 2019 +0000
  
      [Target] Protect Processes' language runtimes map with a mutex
      
      Summary:
      From what I understand, it's possible for multiple threads to request
      a specific language runtime (e.g. CPPLanguageRuntime). This leads to a data
      race.
      
      Reviewers: jingham, JDevlieghere, compnerd, clayborg
      
      Differential Revision: https://reviews.llvm.org/D62169
      
      llvm-svn: 361442

On top of master I have two commits to add lld, libcxxabi, gtest_main and gtest:

  $ git log -2 -p
  commit b6b78d5b1d55b7643634ded9412c42dd52782e37 (HEAD -> Use-LTO-capable-linker-and-add-libcxxabi)
  Author: Wink Saville <wink at saville.com>
  Date:   Thu May 23 08:14:44 2019 -0700
  
      Add gtest_main and gtest
      
      See if this fixes check all
  
  diff --git a/clang/cmake/caches/DistributionExample.cmake b/clang/cmake/caches/DistributionExample.cmake
  index 50fcc09cf07..fd525b8f4ce 100644
  --- a/clang/cmake/caches/DistributionExample.cmake
  +++ b/clang/cmake/caches/DistributionExample.cmake
  @@ -24,6 +24,8 @@ endif()
   
   # Expose stage2 targets through the stage1 build configuration.
   set(CLANG_BOOTSTRAP_TARGETS
  +  gtest_main
  +  gtest
     check-all
     check-llvm
     check-clang
  
  commit b99e88f595fd3e27e68c18d95f88552cb25aea43 (origin/Use-LTO-capable-linker-and-add-libcxxabi, origin/Use-LTO-capable-linker)
  Author: Wink Saville <wink at saville.com>
  Date:   Wed May 22 16:23:47 2019 -0700
  
      Use LTO capable linker and add libcxxabi
      
      In DistributionExample.cmake be sure we use a LTO
      capable linker, the easiest to choose is lld.
      
      Reviewers: beanz
      
      Subscribers: mgorny, mehdi_amini, inglorion, dexonsmith, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D62279
  
  diff --git a/clang/cmake/caches/DistributionExample-stage2.cmake b/clang/cmake/caches/DistributionExample-stage2.cmake
  index f4d5d92d1d1..99d5dc0fd2f 100644
  --- a/clang/cmake/caches/DistributionExample-stage2.cmake
  +++ b/clang/cmake/caches/DistributionExample-stage2.cmake
  @@ -2,7 +2,7 @@
   # bootstrap build.
   
   set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
  -set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "")
  +set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi" CACHE STRING "")
   
   set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
   
  diff --git a/clang/cmake/caches/DistributionExample.cmake b/clang/cmake/caches/DistributionExample.cmake
  index 35493edd17f..50fcc09cf07 100644
  --- a/clang/cmake/caches/DistributionExample.cmake
  +++ b/clang/cmake/caches/DistributionExample.cmake
  @@ -2,7 +2,7 @@
   
   #Enable LLVM projects and runtimes
   set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra;lld" CACHE STRING "")
  -set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx" CACHE STRING "")
  +set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi" CACHE STRING "")
   
   # Only build the native target in stage1 since it is a throwaway build.
   set(LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
  @@ -17,6 +17,11 @@ set(PACKAGE_VENDOR LLVM.org CACHE STRING "")
   # the proper LTO library dependencies can be connected.
   set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
   
  +if (NOT APPLE)
  +  # Since LLVM_ENABLE_LTO is ON we need a LTO capable linker
  +  set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
  +endif()
  +
   # Expose stage2 targets through the stage1 build configuration.
   set(CLANG_BOOTSTRAP_TARGETS
     check-all

So the commits from your commit to HEAD is:

  $ git log --oneline ed0036796164b3a2a93be8e2707984f57ba94e24^..HEAD
  b6b78d5b1d5 (HEAD -> Use-LTO-capable-linker-and-add-libcxxabi) Add gtest_main and gtest
  b99e88f595f (origin/Use-LTO-capable-linker-and-add-libcxxabi, origin/Use-LTO-capable-linker) Use LTO capable linker and add libcxxabi
  74eb76f6c31 (upstream/master, origin/master, origin/HEAD, master) [Target] Protect Processes' language runtimes map with a mutex
  a98a4fb57f5 [ORC] Remove a stray decl that accidentally found its way in to r361322.
  bb2b52769b4 Actaully lock accesses to OptionValueFileSpecList objects
  dd0fe187ab8 Fix r361428 for Windows buildbots/mangling
  e78cb1f20b2 Fix new enum-codegen.cpp test
  00be4e68ad6 [docs] Make a note of the HowToUseLLJIT example in the ORCv2 design doc.
  ed003679616 [Runtimes] If LLVM_INCLUDE_TESTS=On depend on gtest

Even with both gtest patches it still isn't working, `ninja check-all` is failing as before :(

  [1100/1554] cd /home/wink/prgs/llvm/llvm-project/build-dist-use-lto-capable-linker-and-add-libcxxabi-add-gtest/tools/clang/stage2-bins/runtimes/runtimes-bins && /usr/bin/cmake --build /home/wink/prgs/llvm/llvm-project/build-dist-use-lto-capable-linker-and-add-libcxxabi-add-gtest/tools/clang/stage2-bins/runtimes/runtimes-bins/ --target check-runtimes --config RelWithDebInfo
  ninja: error: '/home/wink/prgs/llvm/llvm-project/build-dist-use-lto-capable-linker-and-add-libcxxabi-add-gtest/tools/clang/stage2-bins/lib/libgtest.a', needed by 'compiler-rt/lib/asan/tests/ASAN_INST_TEST_OBJECTS.gtest-all.cc.x86_64-calls.o', missing and no known rule to make it
  FAILED: runtimes/CMakeFiles/check-runtimes 
  cd /home/wink/prgs/llvm/llvm-project/build-dist-use-lto-capable-linker-and-add-libcxxabi-add-gtest/tools/clang/stage2-bins/runtimes/runtimes-bins && /usr/bin/cmake --build /home/wink/prgs/llvm/llvm-project/build-dist-use-lto-capable-linker-and-add-libcxxabi-add-gtest/tools/clang/stage2-bins/runtimes/runtimes-bins/ --target check-runtimes --config RelWithDebInfo

Is there a way to "force" gtest/gtest_main to get included just so I can see if there is any other `check-all` failures?

Other suggestions?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62279/new/

https://reviews.llvm.org/D62279





More information about the cfe-commits mailing list