[llvm] [Offload] Fix PowerPC builds that pass -mcpu (PR #138327)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 2 12:16:48 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-offload

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
Another hacky fix done until
https://github.com/llvm/llvm-project/pull/136729 lands. This time for
`-mcpu`.


---
Full diff: https://github.com/llvm/llvm-project/pull/138327.diff


1 Files Affected:

- (modified) offload/DeviceRTL/CMakeLists.txt (+7-3) 


``````````diff
diff --git a/offload/DeviceRTL/CMakeLists.txt b/offload/DeviceRTL/CMakeLists.txt
index f8a6d8563916a..09710e5e3da43 100644
--- a/offload/DeviceRTL/CMakeLists.txt
+++ b/offload/DeviceRTL/CMakeLists.txt
@@ -132,9 +132,12 @@ function(compileDeviceRTLLibrary target_name target_triple)
     BUILD_RPATH ""
     INSTALL_RPATH ""
     RUNTIME_OUTPUT_NAME libomptarget-${target_name}.bc)
-  target_compile_options(libomptarget-${target_name} PRIVATE "--target=${target_triple}" "-fuse-ld=lld" "-march=")
+  target_compile_options(libomptarget-${target_name} PRIVATE
+    "--target=${target_triple}" "-fuse-ld=lld" "-march=" "-mcpu="
+    "-Wno-unused-command-line-argument")
   target_link_options(libomptarget-${target_name} PRIVATE "--target=${target_triple}"
-                      "-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm" "-fuse-ld=lld" "-march=")
+                      "-mcpu=power8" "-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm"
+                      "-fuse-ld=lld" "-march=" "-mcpu=")
   install(TARGETS libomptarget-${target_name}
           PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
           DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${target_triple}")
@@ -152,7 +155,8 @@ function(compileDeviceRTLLibrary target_name target_triple)
   )
   target_link_libraries(omptarget.${target_name} PRIVATE omptarget.${target_name}.all_objs)
   target_link_options(omptarget.${target_name} PRIVATE "--target=${target_triple}"
-                      "-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm" "-fuse-ld=lld" "-march=")
+                      "-Wno-unused-command-line-argument""-r" "-nostdlib" "-flto"
+                       "-Wl,--lto-emit-llvm" "-fuse-ld=lld" "-march=" "-mcpu=")
 
   install(TARGETS omptarget.${target_name}
           ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/${target_triple}")

``````````

</details>


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


More information about the llvm-commits mailing list