https://reviews.llvm.org/D61446 introduced a new function to process pass plugins that used CMAKE_BINARY_DIR. This is problematic when LLVM is a subproject. Instead use CMAKE_CURRENT_BINARY_DIR to get the right relative directory for cmake.
I don't think CMAKE_CURRENT_BINARY_DIR will work. It is different for each subdirectory, such that multiple plugins create separate Extension.def.tmp instead of appending to a central one. LLVM_BINARY_DIR might be the better choice.
That they didn't match was a left over mistake from testing. In my setups they evaluated to the same values. I'll switch all uses to LLVM_BINARY_DIR as Meinersbur suggested.
This broke standalone build of clang. It's trying to write into /include (as in, root directory) now! My guess is that LLVM_BINARY_DIR is undefined at this point of standalone build, later it might be defined to point to directory where LLVM was installed which also wouldn't be correct.
* ACCESS DENIED: mkdir: /include CMake Error at /usr/lib/llvm/11/lib64/cmake/llvm/AddLLVM.cmake:894 (file): file failed to open for writing (No such file or directory): /include/llvm/Support/Extension.def.tmp Call Stack (most recent call first): CMakeLists.txt:867 (process_llvm_pass_plugins)