[llvm-bugs] [Bug 46838] New: Scudo tests do not link when building LLVM with ThinLTO

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 24 10:56:50 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46838

            Bug ID: 46838
           Summary: Scudo tests do not link when building LLVM with
                    ThinLTO
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: kostyak at google.com
          Reporter: aeubanks at google.com
                CC: hans at chromium.org, htmldeveloper at gmail.com,
                    llvm-bugs at lists.llvm.org, mitchphillips at outlook.com,
                    peter at pcc.me.uk

$ 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 https://reviews.llvm.org/D84466,
which doesn't solve this problem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200724/2cd36e89/attachment.html>


More information about the llvm-bugs mailing list