[Openmp-commits] [openmp] [OpenMP] Add extra flags to libomptarget and plugin builds (PR #74520)
via Openmp-commits
openmp-commits at lists.llvm.org
Tue Dec 5 12:37:47 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-openmp
Author: Johannes Doerfert (jdoerfert)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/74520.diff
2 Files Affected:
- (modified) openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt (+16)
- (modified) openmp/libomptarget/src/CMakeLists.txt (+16)
``````````diff
diff --git a/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt b/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
index 5b332ed3d2f41..7c349ffd2026f 100644
--- a/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
+++ b/openmp/libomptarget/plugins-nextgen/common/CMakeLists.txt
@@ -88,6 +88,22 @@ target_compile_definitions(PluginCommon PRIVATE
DEBUG_PREFIX="PluginInterface"
)
+target_compile_options(PluginCommon PUBLIC -fno-exceptions)
+
+if(NOT LLVM_ENABLE_RTTI)
+ target_compile_options(PluginCommon PUBLIC -fno-rtti)
+endif()
+
+include(CheckIPOSupported)
+check_ipo_supported(RESULT use_lto OUTPUT output)
+if(use_lto)
+ target_compile_options(PluginCommon PUBLIC -flto)
+ target_link_options(PluginCommon PUBLIC -flto)
+else()
+ message(WARNING "LTO is not supported: ${output}")
+endif()
+
+
target_include_directories(PluginCommon
PRIVATE
${LIBOMPTARGET_INCLUDE_DIR}
diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt
index 7c311f738ac8e..e907a1b25566b 100644
--- a/openmp/libomptarget/src/CMakeLists.txt
+++ b/openmp/libomptarget/src/CMakeLists.txt
@@ -55,6 +55,22 @@ target_compile_definitions(omptarget PRIVATE
DEBUG_PREFIX="omptarget"
)
+target_compile_options(omptarget PRIVATE -fno-exceptions)
+
+if(NOT LLVM_ENABLE_RTTI)
+ target_compile_options(omptarget PRIVATE -fno-rtti)
+endif()
+
+include(CheckIPOSupported)
+check_ipo_supported(RESULT use_lto OUTPUT output)
+if(use_lto)
+ target_compile_options(omptarget PUBLIC -flto)
+ target_link_options(omptarget PUBLIC -flto)
+else()
+ message(WARNING "LTO is not supported: ${output}")
+endif()
+
+
# libomptarget.so needs to be aware of where the plugins live as they
# are now separated in the build directory.
set_target_properties(omptarget PROPERTIES
``````````
</details>
https://github.com/llvm/llvm-project/pull/74520
More information about the Openmp-commits
mailing list