[llvm] [Offload] Fix PowerPC builds that pass -mcpu (PR #138327)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Tue May 6 11:17:15 PDT 2025
https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/138327
>From 2713b4099ded5e8fac0f58f43acafd9a62b89e27 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Fri, 2 May 2025 14:15:06 -0500
Subject: [PATCH 1/2] [Offload] Fix PowerPC builds that pass -mcpu
Summary:
Another hacky fix done until
https://github.com/llvm/llvm-project/pull/136729 lands. This time for
`-mcpu`.
---
offload/DeviceRTL/CMakeLists.txt | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
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}")
>From b4c48590f2b342af972c14ba6f333c0b48abb55f Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 6 May 2025 13:17:07 -0500
Subject: [PATCH 2/2] Update CMakeLists.txt
---
offload/DeviceRTL/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/offload/DeviceRTL/CMakeLists.txt b/offload/DeviceRTL/CMakeLists.txt
index 09710e5e3da43..82fccbe3bfcb2 100644
--- a/offload/DeviceRTL/CMakeLists.txt
+++ b/offload/DeviceRTL/CMakeLists.txt
@@ -136,7 +136,7 @@ function(compileDeviceRTLLibrary target_name target_triple)
"--target=${target_triple}" "-fuse-ld=lld" "-march=" "-mcpu="
"-Wno-unused-command-line-argument")
target_link_options(libomptarget-${target_name} PRIVATE "--target=${target_triple}"
- "-mcpu=power8" "-r" "-nostdlib" "-flto" "-Wl,--lto-emit-llvm"
+ "-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
More information about the llvm-commits
mailing list