From c4bb83ea5bd8a1f61808932d80de8e49f2a08475 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Mon, 29 Jun 2026 20:09:16 +0200 Subject: [PATCH] [Flang-RT] Make implicit PPC intrinsic uses explicit (#206493) The PPC-specific builtin moduls have implicit dependencies insert by flang. For CMake to correctly setup the build order, they must be made explicit. This replicates the implicit module uses from https://github.com/llvm/llvm-project/blob/12b20b36737094b1c521adff0c8f58aaaf2f41fb/flang/lib/Semantics/semantics.cpp#L680-L693 in the modules themselves. The PPC-specific modules compiled by Flang-RT are listed here: https://github.com/llvm/llvm-project/blob/12b20b36737094b1c521adff0c8f58aaaf2f41fb/flang-rt/lib/runtime/CMakeLists.txt#L213-L219 This should fix the intermittend build error mentioned in https://github.com/llvm/llvm-project/pull/205634#issuecomment-4829653483. Unfortunately I do not have a PowerPC (cross-)compilation build environment ready to test, nor does the Premerge-CI build it. --- flang-rt/lib/runtime/__ppc_intrinsics.f90 | 1 + flang-rt/lib/runtime/__ppc_types.f90 | 1 + flang-rt/lib/runtime/mma.f90 | 2 ++ 3 files changed, 4 insertions(+) diff --git a/flang-rt/lib/runtime/__ppc_intrinsics.f90 b/flang-rt/lib/runtime/__ppc_intrinsics.f90 index b3ff33b0619f..1c917cefec0a 100644 --- a/flang-rt/lib/runtime/__ppc_intrinsics.f90 +++ b/flang-rt/lib/runtime/__ppc_intrinsics.f90 @@ -7,6 +7,7 @@ !===------------------------------------------------------------------------===! module __ppc_intrinsics + use __ppc_types ! implicit dependencies, made explicit for CMake private diff --git a/flang-rt/lib/runtime/__ppc_types.f90 b/flang-rt/lib/runtime/__ppc_types.f90 index 7a7c7898ebf8..d98dd8018283 100644 --- a/flang-rt/lib/runtime/__ppc_types.f90 +++ b/flang-rt/lib/runtime/__ppc_types.f90 @@ -7,6 +7,7 @@ !===------------------------------------------------------------------------===! module __ppc_types + use __fortran_builtins ! implicit dependency, made explicit for CMake implicit none ! Set PRIVATE by default to explicitly only export what is meant diff --git a/flang-rt/lib/runtime/mma.f90 b/flang-rt/lib/runtime/mma.f90 index 4c41822e000a..04f9a35b5d5a 100644 --- a/flang-rt/lib/runtime/mma.f90 +++ b/flang-rt/lib/runtime/mma.f90 @@ -7,6 +7,8 @@ !===------------------------------------------------------------------------===! module mma + use __ppc_types ! implicit dependencies, made explicit for CMake + implicit none private