I am planning to land https://github.com/llvm/llvm-project/pull/171515 tomorrow (2026-05-29) at about the same time as this post. At the first try (https://github.com/llvm/llvm-project/pull/137828) some have mentioned an expectation of an announcement, so here it is.
The PR changes how the builtin modules are built and where they are located. The location changes from
${LLVM_PREFIX}/include/flang
to
${LLVM_PREFIX}/lib/clang/${VERSION}/finclude/flang/${TARGET_TRIPLE}
since buitin module files are target-specific as well as tied to a specific version of flang. This avoids using the wrong modules, e.g. when cross-compiling or multiple versions of flang are installed into /usr. The driver now determines the builtn search path and adds -fintrinsic-module-path to flang -fc1. The driver changes have already landed in https://github.com/llvm/llvm-project/pull/196558 . It currently searches both – the old and the new path – but I intend a followup-pr to remove the old location from the search path.
Second change is how modules are built. Previously the module build instructions where in llvm-project/flang/tools/f18/CMakeLists.txt at main · llvm/llvm-project · GitHub (although have been no f18 executable for a long time), and are now in flang-rt/lib/runtime. It is using CMake’s Fortran support to invoke the compiler and determine module dependencies.
When using a bootstrapping build (LLVM_ENABLE_RUNTIMES=flang-rt, added implicitly with LLVM_ENABLE_PROJECTS=flang), the builtin modules are automatically emitted into the driver’s search path, in the build dir, and the installation directory. So in the most cases there is nothing that users/distributions who compile LLVM themselves using a bootstrapping build have to do. If using a different build mode, one can use cmake -DFLANG_TEST_Fortran_FLAGS=-fintrinsic-module-path=${path_to_builtin_modules} for check-flang to find them. Otherwise, check-flang will just skip most tests.