<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58553>58553</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang][unittest] ClangSupportTests link time failure
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jmciver
</td>
</tr>
</table>
<pre>
## Issue
When running `ninja-build check-all` `ClangSupportTests` is failing to link:
```
[15/65] Linking CXX executable tools/clang/unittests/Support/ClangSupportTests
FAILED: tools/clang/unittests/Support/ClangSupportTests
: && /usr/bin/c++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3 -DNDEBUG -fuse-ld=gold -Wl,--gc-sections tools/clang/unittests/Support/CMakeFiles/ClangSupportTests.dir/TimeProfilerTest.cpp.o -o tools/clang/unittests/Support/ClangSupportTests -Wl,-rpath,/work/userid/llvm-main/build/release/lib lib/libllvm_gtest_main.so.16git lib/libllvm_gtest.so.16git lib/libclangFrontend.so.16git lib/libLLVMSupport.so.16git -Wl,-rpath-link,/work/userid/llvm-main/build/release/lib && :
tools/clang/unittests/Support/CMakeFiles/ClangSupportTests.dir/TimeProfilerTest.cpp.o:TimeProfilerTest.cpp:function (anonymous namespace)::compileFromString(llvm::StringRef)::TestFrontendAction::CreateASTConsumer(clang::CompilerInstance&, llvm::StringRef): error: undefined reference to 'vtable for clang::ASTConsumer'
/usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function
tools/clang/unittests/Support/CMakeFiles/ClangSupportTests.dir/TimeProfilerTest.cpp.o:TimeProfilerTest.cpp:function TimeProfilerTest_ConstantEvaluation_Test::TestBody() [clone .localalias]: error: undefined reference to 'clang::PCHContainerOperations::PCHContainerOperations()'
tools/clang/unittests/Support/CMakeFiles/ClangSupportTests.dir/TimeProfilerTest.cpp.o:TimeProfilerTest.cpp:function TimeProfilerTest_ConstantEvaluation_Test::TestBody() [clone .localalias]: error: undefined reference to 'clang::CodeGenOptions::CodeGenOptions()'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
```
## Environment
* Commit ID used for testing: 2ec380b23f2e7058a1732582f890f9b41fd94175
* OS: Fedora 36
* Tested using clean build environment
CMake options:
```
cmake \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_USE_LINKER=gold \
-DLLVM_ENABLE_PROJECTS="clang;llvm;lldb;clang-tools-extra;openmp;compiler-rt" \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DBUILD_SHARED_LIBS=ON \
../../llvm-project/llvm
```
## Possible Resolution
https://reviews.llvm.org/D136546
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztV0mT2jgU_jVwUZkCuzFw4MDWHSa9FZBJ5kTJlgxKy5ZHknvJr59Psmm6O6STStVUzWEoyst7T_reorc4Uexp3Aoj_MnSmIq3uvNWd1JfP-95QXRVFKLYkVbcxf0rDZJKSEbSPU_vAiol6I43k7TYrauyVNpuuLHG0YUhGRXSLbeK4H7XiiYvESDU_OvX_rTXb4Xncb_Vn5NLyLulsy9fCH_kaWVpIjl2UtJAKHWIuFeFsNYjhueNAnj6Xh-PcD5ZXi7m0OJ3tyGNptihFcb4E7fWaFwTUbj9WuEUfx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