[llvm-branch-commits] [llvm] [openmp] [openmp] Add support for Arm64X to libomp (PR #176157)

Michael Kruse via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 27 07:20:33 PST 2026


================
@@ -0,0 +1,97 @@
+# check if we have the right linker flags to enable Arm64X
+include(CheckLinkerFlag)
+check_linker_flag(CXX "LINKER:/linkreprofullpathrsp:test_rsp" LIBOMP_HAVE_LINKREPROFULLPATHRSP_FLAG)
+if(NOT LIBOMP_HAVE_LINKREPROFULLPATHRSP_FLAG)
+  message(FATAL_ERROR "Arm64X builds are enabled but the linker does not support the required flag. "
+    "Either update Visual Studio if using link.exe or add lld to LLVM_ENABLE_PROJECTS to use a newer lld.")
+endif()
+
+# directory where the link.rsp file generated during arm64 build will be stored
+set(arm64ReproDir "${LLVM_BINARY_DIR}/runtimes/repros-arm64ec")
+
+# Don't install the runtime if we are doing an arm64ec build for arm64x.
+# The hybrid arm64x runtime will get installed by the host (default) runtime build
+if (LIBOMP_ARCH STREQUAL "arm64ec")
+  set(CMAKE_SKIP_INSTALL_RULES On)
+endif()
+
+# This function reads in the content of the rsp file outputted from the arm64ec build for a target,
+# then passes the arm64ec libs and objs to the linker using /machine:arm64x to combine them with the
+# arm64 counterparts and create an arm64x binary.
+function(set_arm64ec_dll_dependencies target)
+  set(REPRO_FILE "${arm64ReproDir}/${target}.rsp")
+  file(STRINGS "${REPRO_FILE}" ARM64_OBJS REGEX obj\"$)
+  file(STRINGS "${REPRO_FILE}" ARM64_LIBS REGEX lib\"$)
+  string(REPLACE "\"" ";" ARM64_OBJS "${ARM64_OBJS}")
+  string(REPLACE "\"" ";" ARM64_LIBS "${ARM64_LIBS}")
+
+  get_target_property(libs "${target}" LINK_FLAGS)
+  set(non_def "")
+
+  # Separate out the /def flag from the other link flags, so we can replcae it with /defArm64Native.
+  foreach(lib ${libs})
+    if(lib MATCHES ".*\.def")
+      string(REPLACE "/DEF:" "" def ${lib})
----------------
Meinersbur wrote:

```suggestion
      string(REPLACE "/DEF:" "" "def" "${lib}")
```

https://github.com/llvm/llvm-project/pull/176157


More information about the llvm-branch-commits mailing list