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 @@ -318,6 +318,8 @@ endif()
318318option (LIBCXX_HERMETIC_STATIC_LIBRARY
319319 "Do not export any symbols from the static library." ${LIBCXX_HERMETIC_STATIC_LIBRARY_DEFAULT} )
320320
321+ option (LIBCXX_EXECUTE_ONLY_CODE "Compile libc++ as execute-only." OFF )
322+
321323#===============================================================================
322324# Check option configurations
323325#===============================================================================
@@ -538,6 +540,17 @@ function(cxx_add_basic_build_flags target)
538540 # errors.
539541 target_compile_definitions (${target} PRIVATE -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES)
540542
543+ if (LIBCXX_EXECUTE_ONLY_CODE)
544+ target_add_compile_flags_if_supported(${target} PRIVATE -mexecute-only)
545+ if (NOT CXX_SUPPORTS_MEXECUTE_ONLY_FLAG)
546+ target_add_compile_flags_if_supported(${target} PRIVATE -mpure-code)
547+ if (NOT CXX_SUPPORTS_MPURE_CODE_FLAG)
548+ message (SEND_ERROR "Compiler doesn't support -mexecute-only or "
549+ "-mpure-code option for target ${target} !" )
550+ endif ()
551+ endif ()
552+ endif ()
553+
541554 if (C_SUPPORTS_COMMENT_LIB_PRAGMA)
542555 if (LIBCXX_HAS_PTHREAD_LIB)
543556 target_compile_definitions (${target} PRIVATE -D_LIBCPP_LINK_PTHREAD_LIB)
You can’t perform that action at this time.
0 commit comments