File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,25 @@ if(LIBOMPTARGET_ENABLE_DEBUG)
75
75
add_definitions (-DOMPTARGET_DEBUG )
76
76
endif ()
77
77
78
+ # No exceptions and no RTTI, except if requested.
79
+ set (offload_compile_flags -fno-exceptions )
80
+ if (NOT LLVM_ENABLE_RTTI )
81
+ set (offload_compile_flags ${offload_compile_flags} -fno-rtti )
82
+ endif ()
83
+
84
+ # If LTO is not explicitly disabled we check if we can enable it and do so.
85
+ set (LIBOMPTARGET_USE_LTO TRUE CACHE BOOL "Use LTO for the offload runtimes if available" )
86
+ if (LIBOMPTARGET_USE_LTO )
87
+ include (CheckIPOSupported )
88
+ check_ipo_supported (RESULT use_lto OUTPUT output )
89
+ if (use_lto )
90
+ set (offload_compile_flags ${offload_compile_flags} -flto )
91
+ set (offload_link_flags ${offload_link_flags} -flto )
92
+ else ()
93
+ message (WARNING "LTO is not supported: ${output} " )
94
+ endif ()
95
+ endif ()
96
+
78
97
# OMPT support for libomptarget
79
98
# Follow host OMPT support and check if host support has been requested.
80
99
# LIBOMP_HAVE_OMPT_SUPPORT indicates whether host OMPT support has been implemented.
Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ target_compile_definitions(PluginCommon PRIVATE
88
88
DEBUG_PREFIX= "PluginInterface"
89
89
)
90
90
91
+ target_compile_options (PluginCommon PUBLIC ${offload_compile_flags} )
92
+ target_link_options (PluginCommon PUBLIC ${offload_link_flags} )
93
+
91
94
target_include_directories (PluginCommon
92
95
PRIVATE
93
96
${LIBOMPTARGET_INCLUDE_DIR}
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ target_compile_definitions(omptarget PRIVATE
55
55
DEBUG_PREFIX= "omptarget"
56
56
)
57
57
58
+ target_compile_options (omptarget PUBLIC ${offload_compile_flags} )
59
+ target_link_options (omptarget PUBLIC ${offload_link_flags} )
60
+
58
61
macro (check_plugin_target target )
59
62
if (TARGET omptarget.rtl.${target} )
60
63
list (APPEND LIBOMPTARGET_PLUGINS_TO_LOAD ${target} )
You can’t perform that action at this time.
0 commit comments