File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,8 @@ endif()
143143option (LIBCXXABI_HERMETIC_STATIC_LIBRARY
144144 "Do not export any symbols from the static library." ${LIBCXXABI_HERMETIC_STATIC_LIBRARY_DEFAULT} )
145145
146+ option (LIBCXXABI_EXECUTE_ONLY_CODE "Compile libc++abi as execute-only." OFF )
147+
146148if (MINGW)
147149 set (LIBCXXABI_DEFAULT_TEST_CONFIG "llvm-libc++abi-mingw.cfg.in" )
148150elseif (WIN32 ) # clang-cl
@@ -446,6 +448,17 @@ if (C_SUPPORTS_COMMENT_LIB_PRAGMA)
446448 endif ()
447449endif ()
448450
451+ if (LIBCXXABI_EXECUTE_ONLY_CODE)
452+ add_compile_flags_if_supported(-mexecute-only)
453+ if (NOT CXX_SUPPORTS_MEXECUTE_ONLY_FLAG)
454+ add_compile_flags_if_supported(-mpure-code)
455+ if (NOT CXX_SUPPORTS_MPURE_CODE_FLAG)
456+ message (SEND_ERROR
457+ "Compiler doesn't support -mexecute-only or -mpure-code option!" )
458+ endif ()
459+ endif ()
460+ endif ()
461+
449462string (REPLACE ";" " " LIBCXXABI_CXX_FLAGS "${LIBCXXABI_CXX_FLAGS} " )
450463set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXXABI_CXX_FLAGS} " )
451464set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS} " )
You can’t perform that action at this time.
0 commit comments