[llvm] [Flang-RT] Do not use Apple-specific libdir scheme (PR #151954)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 05:44:19 PDT 2025


https://github.com/Meinersbur created https://github.com/llvm/llvm-project/pull/151954

With `-target x86_64-apple-darwin`, flang looks for the following directories for flang-rt:

`lib/x86_64-apple-darwin`
`lib/darwin/x86_64`

while `get_toolchain_library_subdir` returned the following dir:

`lib/darwin`

The `APPLE` exception was copied over from compiler-rt. Either it doesn't work there either, or was not adapted correctly.
We remove the special Apple handling such that flang-rt is emitted into `lib/x86_64-apple-darwin`. 

Fixes #151031 #150765

>From ea175cbbecc3f89319846fd20daa53711bd1969e Mon Sep 17 00:00:00 2001
From: Michael Kruse <llvm-project at meinersbur.de>
Date: Mon, 4 Aug 2025 14:36:01 +0200
Subject: [PATCH] Do not use apple-specific scheme

---
 flang-rt/cmake/modules/GetToolchainDirs.cmake | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/flang-rt/cmake/modules/GetToolchainDirs.cmake b/flang-rt/cmake/modules/GetToolchainDirs.cmake
index fba12502b5946..d9381c88e6518 100644
--- a/flang-rt/cmake/modules/GetToolchainDirs.cmake
+++ b/flang-rt/cmake/modules/GetToolchainDirs.cmake
@@ -34,14 +34,8 @@
 function (get_toolchain_library_subdir outvar)
   set(outval "lib")
 
-  if (APPLE)
-    # Required to be "darwin" for MachO toolchain.
-    get_toolchain_os_dirname(os_dirname)
-    set(outval "${outval}/${os_dirname}")
-  else ()
-    get_toolchain_arch_dirname(arch_dirname)
-    set(outval "${outval}/${arch_dirname}")
-  endif ()
+  get_toolchain_arch_dirname(arch_dirname)
+  set(outval "${outval}/${arch_dirname}")
 
   set(${outvar} "${outval}" PARENT_SCOPE)
 endfunction ()



More information about the llvm-commits mailing list