Skip to content

Commit d56bb1c

Browse files
committed
Use function-like macro on command line instead
1 parent 6fc8287 commit d56bb1c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

flang-rt/cmake/modules/AddFlangRT.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ function (add_flangrt_library name)
231231
target_compile_options(${tgtname} PRIVATE
232232
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions -fno-rtti -funwind-tables -fno-asynchronous-unwind-tables>
233233
)
234+
235+
# Define our own _GLIBCXX_THROW_OR_ABORT because libstdc++ headers
236+
# reference std::exception in its definition, and we do not want
237+
# to link against std::exception since doing that would link us to
238+
# the C++ runtime.
239+
target_compile_options(${tgtname} PUBLIC "-D_GLIBCXX_THROW_OR_ABORT(_EXC)=(__builtin_abort())")
234240
elseif (MSVC)
235241
target_compile_options(${tgtname} PRIVATE
236242
$<$<COMPILE_LANGUAGE:CXX>:/EHs-c- /GR->
@@ -286,12 +292,6 @@ function (add_flangrt_library name)
286292
# For Flang-RT's configured config.h to be found
287293
target_include_directories(${tgtname} PRIVATE "${FLANG_RT_BINARY_DIR}")
288294

289-
# Define our own _GLIBCXX_THROW_OR_ABORT because libstdc++ headers
290-
# reference std::exception in its definition, and we do not want
291-
# to link against std::exception since doing that would link us to
292-
# the C++ runtime.
293-
target_compile_definitions(${tgtname} PUBLIC "_GLIBCXX_THROW_OR_ABORT=(__builtin_abort())")
294-
295295
# Disable libstdc++/libc++ assertions, even in an LLVM_ENABLE_ASSERTIONS
296296
# build, to avoid an unwanted dependency on libstdc++/libc++.so.
297297
target_compile_definitions(${tgtname} PUBLIC _GLIBCXX_NO_ASSERTIONS)

0 commit comments

Comments
 (0)