diff --git a/CMakeLists.txt b/CMakeLists.txt index 091a4b906ca..571aadae5ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -253,7 +253,7 @@ if(CONFIG_CPP) zephyr_compile_options($<$:${STD_CPP_DIALECT_FLAGS}>) endif() -if(NOT CONFIG_EXCEPTIONS) +if(NOT CONFIG_CPP_EXCEPTIONS) # @Intent: Obtain compiler specific flags related to C++ Exceptions zephyr_compile_options($<$:$>) endif() @@ -1479,7 +1479,7 @@ if(CONFIG_BUILD_OUTPUT_ADJUST_LMA) ) endif() -if(NOT CONFIG_EXCEPTIONS) +if(NOT CONFIG_CPP_EXCEPTIONS) set(eh_frame_section ".eh_frame") else() set(eh_frame_section "") diff --git a/cmake/linker/ld/target.cmake b/cmake/linker/ld/target.cmake index 539c4b34036..5a654204f71 100644 --- a/cmake/linker/ld/target.cmake +++ b/cmake/linker/ld/target.cmake @@ -15,7 +15,7 @@ endif() set_ifndef(LINKERFLAGPREFIX -Wl) if(NOT "${ZEPHYR_TOOLCHAIN_VARIANT}" STREQUAL "host") - if(CONFIG_EXCEPTIONS) + if(CONFIG_CPP_EXCEPTIONS) # When building with C++ Exceptions, it is important that crtbegin and crtend # are linked at specific locations. # The location is so important that we cannot let this be controlled by normal diff --git a/doc/develop/languages/cpp/index.rst b/doc/develop/languages/cpp/index.rst index 2e9f0357480..b3482ae3cae 100644 --- a/doc/develop/languages/cpp/index.rst +++ b/doc/develop/languages/cpp/index.rst @@ -60,7 +60,7 @@ initialized but before the application :c:func:`main()` function. Therefore, use of C++ is restricted to application code. In order to make use of the C++ exceptions, the -:kconfig:option:`CONFIG_EXCEPTIONS` must be selected in the application +:kconfig:option:`CONFIG_CPP_EXCEPTIONS` must be selected in the application configuration file. Zephyr Minimal C++ Library diff --git a/include/zephyr/arch/x86/ia32/linker.ld b/include/zephyr/arch/x86/ia32/linker.ld index 65e508c7d23..1305860ee70 100644 --- a/include/zephyr/arch/x86/ia32/linker.ld +++ b/include/zephyr/arch/x86/ia32/linker.ld @@ -544,7 +544,7 @@ SECTIONS /* * eh_frame section won't be removed even with "--gc-sections" by LLVM lld. */ -#if !defined(CONFIG_EXCEPTIONS) +#if !defined(CONFIG_CPP_EXCEPTIONS) /DISCARD/ : { *(.eh_frame) } #endif diff --git a/include/zephyr/arch/x86/intel64/linker.ld b/include/zephyr/arch/x86/intel64/linker.ld index 1af071b2da8..f2fd47ad54e 100644 --- a/include/zephyr/arch/x86/intel64/linker.ld +++ b/include/zephyr/arch/x86/intel64/linker.ld @@ -220,7 +220,7 @@ SECTIONS /* * eh_frame section won't be removed even with "--gc-sections" by LLVM lld. */ -#if !defined(CONFIG_EXCEPTIONS) +#if !defined(CONFIG_CPP_EXCEPTIONS) /DISCARD/ : { *(.eh_frame) } #endif diff --git a/include/zephyr/linker/cplusplus-ram.ld b/include/zephyr/linker/cplusplus-ram.ld index 59849f033ee..d4314994919 100644 --- a/include/zephyr/linker/cplusplus-ram.ld +++ b/include/zephyr/linker/cplusplus-ram.ld @@ -10,12 +10,12 @@ *(.gcc_except_table .gcc_except_table.*) } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) -#if defined (CONFIG_EXCEPTIONS) +#if defined (CONFIG_CPP_EXCEPTIONS) SECTION_PROLOGUE(.tm_clone_table,,) { KEEP (*(SORT_NONE(EXCLUDE_FILE (*crtend.o) .tm_clone_table))) KEEP (*(SORT_NONE(.tm_clone_table))) } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) -#endif /* CONFIG_EXCEPTIONS */ +#endif /* CONFIG_CPP_EXCEPTIONS */ #endif /* CONFIG_CPP */ diff --git a/include/zephyr/linker/cplusplus-rom.ld b/include/zephyr/linker/cplusplus-rom.ld index 82be0f4dd28..5981e2f7b98 100644 --- a/include/zephyr/linker/cplusplus-rom.ld +++ b/include/zephyr/linker/cplusplus-rom.ld @@ -10,7 +10,7 @@ *(.gcc_except_table .gcc_except_table.*) } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) -#if defined (CONFIG_EXCEPTIONS) +#if defined (CONFIG_CPP_EXCEPTIONS) SECTION_PROLOGUE(.eh_frame_hdr,,) { *(.eh_frame_hdr) @@ -21,6 +21,6 @@ KEEP (*(SORT_NONE(EXCLUDE_FILE (*crtend.o) .eh_frame))) KEEP (*(SORT_NONE(.eh_frame))) } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) -#endif /* CONFIG_EXCEPTIONS */ +#endif /* CONFIG_CPP_EXCEPTIONS */ #endif /* CONFIG_CPP */ diff --git a/tests/lib/cpp/libcxx/src/main.cpp b/tests/lib/cpp/libcxx/src/main.cpp index db8c87e900b..3151aaae892 100644 --- a/tests/lib/cpp/libcxx/src/main.cpp +++ b/tests/lib/cpp/libcxx/src/main.cpp @@ -67,7 +67,7 @@ ZTEST(libcxx_tests, test_make_unique) zassert_equal(make_unique_data::dtors, 1, "dtor count not incremented"); } -#if defined(CONFIG_EXCEPTIONS) && !defined(CONFIG_BOARD_M2GL025_MIV) +#if defined(CONFIG_CPP_EXCEPTIONS) && !defined(CONFIG_BOARD_M2GL025_MIV) static void throw_exception(void) { throw 42; diff --git a/tests/lib/cpp/libcxx/testcase.yaml b/tests/lib/cpp/libcxx/testcase.yaml index 3a8f23b18da..f437cb86082 100644 --- a/tests/lib/cpp/libcxx/testcase.yaml +++ b/tests/lib/cpp/libcxx/testcase.yaml @@ -7,7 +7,7 @@ tests: tags: cpp extra_configs: - CONFIG_NEWLIB_LIBC=y - - CONFIG_EXCEPTIONS=y + - CONFIG_CPP_EXCEPTIONS=y integration_platforms: - mps2_an385 cpp.libcxx.newlib_nano: