================
@@ -1179,6 +1179,37 @@ void Flang::ConstructJob(Compilation &C, const JobAction 
&JA,
   CmdArgs.push_back("-resource-dir");
   CmdArgs.push_back(D.ResourceDir.c_str());
 
+  // Default intrinsic module dirs must be added after any user-provided
+  // -fintrinsic-modules-path to have lower precedence
+  if (std::optional<std::string> IntrModPath =
+          TC.getDefaultIntrinsicModuleDir()) {
+    CmdArgs.push_back("-fintrinsic-modules-path");
+    CmdArgs.push_back(Args.MakeArgString(*IntrModPath));
+  }
+
+  // Ideally, every target triple has its own set of builtin modules since they
+  // are compiled with platform-dependent conditionals such as `#if 
__x86_64__`.
+  // However, getting the builtin modules for offload targets requires building
+  // the flang-rt and openmp for those targets as well:
+  // -DLLVM_RUNTIME_TARGETS=default;amdgcn-amd-amdhsa;nvptx64-nvidia-cuda.
+  // To reduce friction when build systems have not yet been updated, we also
+  // add the host's builtin module to the search path (with lower priority), in
+  // case a module file has not been found for the offload targets itself.
+  // FIXME: This workaround may mix module files targeting different triples 
and
----------------
Meinersbur wrote:

Please read this PR's summary:
<img width="1047" height="327" alt="image" 
src="https://github.com/user-attachments/assets/c8454a8a-cfc6-410f-bc13-80c72987c04c";
 />

Build system is LLVM's CMake build system. That should already have been 
obvious because 
`LLVM_RUNTIME_TARGETS/LLVM_ENABLE_RUNTIMES/LLVM_ENABLE_PROJECTS` are 
LLVM-build-system-specific options.

https://github.com/llvm/llvm-project/pull/171515
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to