3.31 new linker architecture breaks building LLVM
Reproduction
git clone --depth 1 git@github.com:llvm/llvm-project.git llvm
cd llvm && mkdir build && cd build
cmake ../llvm -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_TARGETS_TO_BUILD="X86" && ninja libclang-cpp.so
The build fails with:
ld.lld: error: undefined symbol: llvm::omp::getOpenMPClauseName(llvm::omp::Clause)
>>> referenced by OpenMPKinds.cpp
>>> tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/OpenMPKinds.cpp.o:(clang::getOpenMPSimpleClauseTypeName(llvm::omp::Clause, unsigned int))
>>> referenced by SemaOpenMP.cpp
>>> tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o:(clang::SemaOpenMP::CheckOMPRequiresDecl(clang::SourceLocation, llvm::ArrayRef<clang::OMPClause*>))
>>> referenced by SemaOpenMP.cpp
>>> tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaOpenMP.cpp.o:(clang::SemaOpenMP::CheckOMPRequiresDecl(clang::SourceLocation, llvm::ArrayRef<clang::OMPClause*>))
>>> referenced 166 more times
ld.lld: error: undefined symbol: llvm::omp::getDirectiveAssociation(llvm::omp::Directive)
>>> referenced by OpenMPKinds.cpp
>>> tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/OpenMPKinds.cpp.o:(clang::isOpenMPLoopDirective(llvm::omp::Directive))
>>> referenced by OpenMPKinds.cpp
>>> tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/OpenMPKinds.cpp.o:(clang::isOpenMPSimdDirective(llvm::omp::Directive))
>>> referenced by ParseOpenMP.cpp
>>> tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o:(clang::Parser::ParseOpenMPExecutableDirective(clang::Parser::ParsedStmtContext, llvm::omp::Directive, clang::SourceLocation, bool))
[tons more]
Environment
OS: Debian Unstable
Compiler: Bloomberg's P2996 (based on LLVM commit 5b697ef, some custom patches)
Linker: lld
Build files
build_good.ninja.gz (commit 587a3b41)
build_bad.ninja.gz (commit c1c4cf95)
Cause
The issue bisects to commit c1c4cf95 from !9665 (merged).
LLVM is big so it's hard for me to minify and the problematic commit is quite a big change too.
CC @marc.chevrier.
Edited by Brad King