<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Scudo tests do not link when building LLVM with ThinLTO"
   href="https://bugs.llvm.org/show_bug.cgi?id=46838">46838</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Scudo tests do not link when building LLVM with ThinLTO
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kostyak@google.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>aeubanks@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>hans@chromium.org, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, mitchphillips@outlook.com, peter@pcc.me.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release
'-DLLVM_ENABLE_PROJECTS=clang;compiler-rt;lld' '-DLLVM_TARGETS_TO_BUILD=X86'
-DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_LTO=Thin
-DCMAKE_C_COMPILER=$PWD/../build_bootstrap/bin/clang
-DCMAKE_CXX_COMPILER=$PWD/../build_bootstrap/bin/clang++  ../llvm

$ ninja TScudoCUnitTest-i386-Test
[2591/2591] Generating ScudoCUnitTest-i386-Test
FAILED:
projects/compiler-rt/lib/scudo/standalone/tests/ScudoCUnitTest-i386-Test
cd
/usr/local/google/home/aeubanks/repos/llvm-project/build_cmake/projects/compiler-rt/lib/scudo/standalone/tests
&& /usr/local/google/home/aeubanks/repos/llvm-project/build_cmake/./bin/clang
ScudoUnitTestsObjects.wrappers_c_test.cpp.i386.o
ScudoUnitTestsObjects.scudo_unit_test_main.cpp.i386.o
ScudoUnitTestsObjects.gtest-all.cc.i386.o
/usr/local/google/home/aeubanks/repos/llvm-project/build_cmake/lib/libRTScudoCUnitTest.i386.a
-o
/usr/local/google/home/aeubanks/repos/llvm-project/build_cmake/projects/compiler-rt/lib/scudo/standalone/tests/./ScudoCUnitTest-i386-Test
-lstdc++ -pthread -latomic -m32
ScudoUnitTestsObjects.wrappers_c_test.cpp.i386.o: file not recognized: file
format not recognized
clang-12: error: linker command failed with exit code 1 (use -v to see
invocation)
ninja: build stopped: subcommand failed.


The command to build ScudoUnitTestsObjects.wrappers_c_test.cpp.i386.o in
build.ninja is:

COMMAND = cd
/usr/local/google/home/aeubanks/repos/llvm-project/build_cmake/projects/compiler-rt/lib/scudo/standalone/tests
&& /usr/local/google/home/aeubanks/repos/llvm-project/build_cmake/./bin/clang
-fPIC -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic
-Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default
-Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor
-Wsuggest-override -Wstring-conversion -fdiagnostics-color -ffunction-sections
-fdata-sections -flto=thin -Wall -std=c++14 -Wno-unused-parameter
-Wno-unknown-warning-option -Wno-covered-switch-default -Wno-suggest-override
-DGTEST_NO_LLVM_SUPPORT=1 -DGTEST_HAS_RTTI=0
-I/usr/local/google/home/aeubanks/repos/llvm-project/llvm/utils/unittest/googletest/include
-I/usr/local/google/home/aeubanks/repos/llvm-project/llvm/utils/unittest/googletest
-I/usr/local/google/home/aeubanks/repos/llvm-project/compiler-rt/include
-I/usr/local/google/home/aeubanks/repos/llvm-project/compiler-rt/lib
-I/usr/local/google/home/aeubanks/repos/llvm-project/compiler-rt/lib/scudo/standalone
-I/usr/local/google/home/aeubanks/repos/llvm-project/compiler-rt/lib/scudo/standalone/include
-DGTEST_HAS_RTTI=0 -DSCUDO_DEBUG=1 -Wno-mismatched-new-delete -DGWP_ASAN_HOOKS
-m32 -c -o ScudoUnitTestsObjects.wrappers_c_test.cpp.i386.o
/usr/local/google/home/aeubanks/repos/llvm-project/compiler-rt/lib/scudo/standalone/tests/wrappers_c_test.cpp

The compile step contains -flto=thin, but the link step does not.


I think this has something to do with the add_library() in
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt which uses whatever flags
CMake has set, but generate_compiler_rt_tests, which calls
sanitizer_test_compile, which calls clang_compile, does not.

I have a review out for a related issue in <a href="https://reviews.llvm.org/D84466">https://reviews.llvm.org/D84466</a>,
which doesn't solve this problem.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>