llvm.org GIT mirror llvm / 61b2fae
Statically link llvm-cfi-verify's libraries. Summary: llvm-cfi-verify (D38379) introduced a potential build failure when compiling with `-DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON`. Specific versions of cmake seem to treat the `add_subdirectory()` rule differently. It seems as if old versions of cmake BFS these rules, adding them to the fringe for expansion later. Newer versions of cmake seem to immediately execute CMakeFiles that are present in this subdirectory. If the subdirectory is expanded through the fringe, the globbing resultant from `llvm_add_implicit_projects()` from `cmake/modules/AddLLVM.cmake:1012` means that `tools/llvm-shlib/CMakeFile.txt` gets executed before `tools/llvm-cfi-verify/lib/CMakeFile.txt`. As the latter CMakeFile adds a new library, this expansion order means that the library files required the unit tests in `unittests/tools/llvm-cfi-verify/` are not present in the dynamic library. This causes unit tests to fail as the required functions can't be found. This change now ensures that the libraries created by `llvm-cfi-verify` are statically linked into the unit tests. As `tools/llvm-cfi-verify/lib` no longer adds anything to `llvm-shlib`, there should be no concern about the order-of-compilation. Reviewers: skatkov, pcc Reviewed By: skatkov, pcc Subscribers: llvm-commits, kcc, pcc, aheejin, vlad.tsyrklevich, mgorny Differential Revision: https://reviews.llvm.org/D39020 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316059 91177308-0d34-0410-b5e6-96231b3b80d8 Vlad Tsyrklevich 2 years ago
2 changed file(s) with 7 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
None add_llvm_library(LLVMCFIVerify
0 add_library(LLVMCFIVerify
1 STATIC
12 FileAnalysis.cpp
2 FileAnalysis.h
3 FileAnalysis.h)
34
4 LINK_COMPONENTS
5 llvm_update_compile_flags(LLVMCFIVerify)
6 llvm_map_components_to_libnames(libs
57 MC
68 MCParser
79 Object
810 Support)
11 target_link_libraries(LLVMCFIVerify ${libs})
33 AllTargetsDescs
44 AllTargetsDisassemblers
55 AllTargetsInfos
6 CFIVerify
76 MC
87 MCParser
98 Object
1413 if (NOT x86_idx LESS 0)
1514 add_llvm_unittest(CFIVerifyTests
1615 FileAnalysis.cpp)
16 target_link_libraries(CFIVerifyTests LLVMCFIVerify)
1717 endif()