diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -48,10 +48,6 @@ include(HandleCompilerRT) # Basic options --------------------------------------------------------------- -option(LIBCXX_ENABLE_ASSERTIONS - "Enable assertions inside the compiled library, and at the same time make it the - default when compiling user code. Note that assertions can be enabled or disabled - by users in their own code regardless of this option." OFF) option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) option(LIBCXX_ENABLE_FILESYSTEM @@ -69,6 +65,9 @@ message(FATAL_ERROR "Unsupported hardening mode: '${LIBCXX_HARDENING_MODE}'. Supported values are ${LIBCXX_SUPPORTED_HARDENING_MODES}.") endif() +option(LIBCXX_ENABLE_ASSERTIONS + "This is a deprecated option that is only temporarily retained for backward + compatibility, please use 'LIBCXX_HARDENING_MODE' instead." OFF) option(LIBCXX_ENABLE_RANDOM_DEVICE "Whether to include support for std::random_device in the library. Disabling this can be useful when building the library for platforms that don't have @@ -777,11 +776,6 @@ config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE) config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS) config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) -if (LIBCXX_ENABLE_ASSERTIONS) - config_define(1 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT) -else() - config_define(0 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT) -endif() if (LIBCXX_HARDENING_MODE STREQUAL "hardened") config_define(1 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT) config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT) @@ -792,6 +786,11 @@ config_define(0 _LIBCPP_ENABLE_HARDENED_MODE_DEFAULT) config_define(0 _LIBCPP_ENABLE_DEBUG_MODE_DEFAULT) endif() +# TODO(LLVM 18): Remove this after branching for LLVM 17, this is a simple +# courtesy for vendors to be notified about this change. +if (LIBCXX_ENABLE_ASSERTIONS) + message(FATAL_ERROR "LIBCXX_ENABLE_ASSERTIONS has been replaced by LIBCXX_HARDENING_MODE=hardened") +endif() if (LIBCXX_PSTL_CPU_BACKEND STREQUAL "serial") config_define(1 _LIBCPP_PSTL_CPU_BACKEND_SERIAL) diff --git a/libcxx/cmake/caches/AIX.cmake b/libcxx/cmake/caches/AIX.cmake --- a/libcxx/cmake/caches/AIX.cmake +++ b/libcxx/cmake/caches/AIX.cmake @@ -6,7 +6,7 @@ set(CMAKE_AR "/usr/bin/ar" CACHE FILEPATH "") set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") -set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "") +set(LIBCXX_HARDENING_MODE "unchecked" CACHE STRING "") set(LIBCXX_ABI_VERSION "1" CACHE STRING "") set(LIBCXX_ENABLE_ABI_LINKER_SCRIPT OFF CACHE BOOL "") set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "") diff --git a/libcxx/cmake/caches/Apple.cmake b/libcxx/cmake/caches/Apple.cmake --- a/libcxx/cmake/caches/Apple.cmake +++ b/libcxx/cmake/caches/Apple.cmake @@ -2,7 +2,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE OFF CACHE BOOL "") set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") -set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "") +set(LIBCXX_HARDENING_MODE "unchecked" CACHE STRING "") set(LIBCXX_ABI_VERSION "1" CACHE STRING "") set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "") set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "") @@ -12,7 +12,6 @@ set(LIBCXX_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "") set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE BOOL "") -set(LIBCXXABI_ENABLE_ASSERTIONS OFF CACHE BOOL "") set(LIBCXXABI_ENABLE_FORGIVING_DYNAMIC_CAST ON CACHE BOOL "") set(LIBCXX_TEST_CONFIG "apple-libc++-shared.cfg.in" CACHE STRING "") diff --git a/libcxx/cmake/caches/FreeBSD.cmake b/libcxx/cmake/caches/FreeBSD.cmake --- a/libcxx/cmake/caches/FreeBSD.cmake +++ b/libcxx/cmake/caches/FreeBSD.cmake @@ -1,7 +1,7 @@ set(CMAKE_BUILD_TYPE Release CACHE STRING "") set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "") -set(LIBCXX_ENABLE_ASSERTIONS OFF CACHE BOOL "") +set(LIBCXX_HARDENING_MODE "unchecked" CACHE STRING "") set(LIBCXX_ABI_VERSION "1" CACHE STRING "") set(LIBCXX_ENABLE_STATIC ON CACHE BOOL "") set(LIBCXX_ENABLE_SHARED ON CACHE BOOL "") diff --git a/libcxx/cmake/caches/Generic-assertions.cmake b/libcxx/cmake/caches/Generic-assertions.cmake deleted file mode 100644 --- a/libcxx/cmake/caches/Generic-assertions.cmake +++ /dev/null @@ -1,2 +0,0 @@ -set(LIBCXX_ENABLE_ASSERTIONS ON CACHE BOOL "") -set(LIBCXXABI_ENABLE_ASSERTIONS ON CACHE BOOL "") diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst --- a/libcxx/docs/BuildingLibcxx.rst +++ b/libcxx/docs/BuildingLibcxx.rst @@ -211,15 +211,6 @@ Toggle the installation of the libc++ headers. -.. option:: LIBCXX_ENABLE_ASSERTIONS:BOOL - - **Default**: ``OFF`` - - Build libc++ with assertions enabled in the compiled library, and enable assertions - by default when building user code as well. Assertions can be turned off by users - by defining ``_LIBCPP_ENABLE_ASSERTIONS=0``. For details, see - :ref:`the documentation `. - .. option:: LIBCXX_ENABLE_SHARED:BOOL **Default**: ``ON`` diff --git a/libcxx/docs/HardenedMode.rst b/libcxx/docs/HardenedMode.rst --- a/libcxx/docs/HardenedMode.rst +++ b/libcxx/docs/HardenedMode.rst @@ -21,18 +21,32 @@ to be used for testing, not in production. Vendors can set the default hardened mode by using the ``LIBCXX_HARDENING_MODE`` -CMake variable. Setting ``LIBCXX_HARDENING_MODE`` to ``hardened`` enables the -hardened mode, and similarly setting the variable to ``debug`` enables the debug -mode. The default value is ``unchecked`` which doesn't enable the hardened mode. -Users can control whether the hardened mode or the debug mode is enabled -on a per translation unit basis by setting the ``_LIBCPP_ENABLE_HARDENED_MODE`` -or ``_LIBCPP_ENABLE_DEBUG_MODE`` macro to ``1``. - -The hardened mode requires ``LIBCXX_ENABLE_ASSERTIONS`` to work. If -``LIBCXX_ENABLE_ASSERTIONS`` was not set explicitly, enabling the hardened mode -(or the debug mode) will implicitly enable ``LIBCXX_ENABLE_ASSERTIONS``. If -``LIBCXX_ENABLE_ASSERTIONS`` was explicitly disabled, this will effectively -disable the hardened mode. +variable at CMake configuration time. Setting ``LIBCXX_HARDENING_MODE`` to +``hardened`` enables the hardened mode, and similarly setting the variable to +``debug`` enables the debug mode. The default value is ``unchecked`` which +doesn't enable the hardened mode. + +When the hardened mode (or the debug mode) is enabled, the compiled library is +built with the corresponding mode enabled, **and** user code will be built with +the same mode enabled by default. If the mode is set to "unchecked" at the CMake +configuration time, the compiled library will not contain any assertions and the +default when building user code will be to have assertions disabled. As a user, +you can consult your vendor to know whether assertions are enabled by default. + +Furthermore, independently of any vendor-selected default, users can always +control whether the hardened mode (or the debug mode) is enabled in their code +by defining ``_LIBCPP_ENABLE_HARDENED_MODE=0|1`` (or +``_LIBCPP_ENABLE_DEBUG_MODE=0|1``) before including any libc++ header (we +recommend passing ``-D_LIBCPP_ENABLE_HARDENED_MODE=X`` or +``-D_LIBCPP_ENABLE_DEBUG_MODE=X`` to the compiler). Note that if the compiled +library was built by the vendor in the unchecked mode, functions compiled inside +the static or shared library won't have hardening assertions enabled even if the +user defines ``_LIBCPP_ENABLE_HARDENED_MODE=1`` (the same is true for the +inverse case where the static or shared library was compiled **with** hardening +assertions but the user tries to disable them). However, most of the code in +libc++ is in the headers, so the user-selected value for +``_LIBCPP_ENABLE_HARDENED_MODE`` or ``_LIBCPP_ENABLE_DEBUG_MODE`` (if any) will +usually be respected. Enabling the hardened mode (or the debug mode) has no impact on the ABI. diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -88,6 +88,11 @@ Deprecations and Removals ------------------------- +- The "safe" mode is replaced by the hardened mode in this release. The ``LIBCXX_ENABLE_ASSERTIONS`` CMake variable is + deprecated and setting it will trigger an error; use ``LIBCXX_HARDENING_MODE`` instead. Similarly, the + ``_LIBCPP_ENABLE_ASSERTIONS`` macro is deprecated and setting it to ``1`` now enables the hardened mode. See + ``libcxx/docs/HardenedMode.rst`` for more details. + - The legacy debug mode has been removed in this release. Setting the macro ``_LIBCPP_ENABLE_DEBUG_MODE`` to ``1`` now enables the new debug mode which is part of hardening (see the "Improvements and New Features" section above). The ``LIBCXX_ENABLE_DEBUG_MODE`` CMake variable has been removed. For additional context, refer to the `Discourse post diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -138,53 +138,31 @@ If you would prefer to not use that flag, then you can replace ``/path/to/include-what-you-use/share/libcxx.imp``` file with the libc++-provided ``libcxx.imp`` file. -.. _assertions-mode: - -Enabling the "safe libc++" mode -=============================== - -Libc++ contains a number of assertions whose goal is to catch undefined behavior in the -library, usually caused by precondition violations. Those assertions do not aim to be -exhaustive -- instead they aim to provide a good balance between safety and performance. -In particular, these assertions do not change the complexity of algorithms. However, they -might, in some cases, interfere with compiler optimizations. - -By default, these assertions are turned off. Vendors can decide to turn them on while building -the compiled library by defining ``LIBCXX_ENABLE_ASSERTIONS=ON`` at CMake configuration time. -When ``LIBCXX_ENABLE_ASSERTIONS`` is used, the compiled library will be built with assertions -enabled, **and** user code will be built with assertions enabled by default. If -``LIBCXX_ENABLE_ASSERTIONS=OFF`` at CMake configure time, the compiled library will not contain -assertions and the default when building user code will be to have assertions disabled. -As a user, you can consult your vendor to know whether assertions are enabled by default. - -Furthermore, independently of any vendor-selected default, users can always control whether -assertions are enabled in their code by defining ``_LIBCPP_ENABLE_ASSERTIONS=0|1`` before -including any libc++ header (we recommend passing ``-D_LIBCPP_ENABLE_ASSERTIONS=X`` to the -compiler). Note that if the compiled library was built by the vendor without assertions, -functions compiled inside the static or shared library won't have assertions enabled even -if the user defines ``_LIBCPP_ENABLE_ASSERTIONS=1`` (the same is true for the inverse case -where the static or shared library was compiled **with** assertions but the user tries to -disable them). However, most of the code in libc++ is in the headers, so the user-selected -value for ``_LIBCPP_ENABLE_ASSERTIONS`` (if any) will usually be respected. +.. _termination-handler: + +Overriding the default termination handler +========================================== When an assertion fails, the program is aborted through a special verbose termination function. The library provides a default function that prints an error message and calls ``std::abort()``. Note that this function is provided by the static or shared library, so it is only available when deploying to a platform where the compiled library is sufficiently recent. On older platforms, the program will terminate in an unspecified unsuccessful manner, but the quality of diagnostics won't be great. + However, users can also override that mechanism at two different levels. First, the mechanism can be -overridden at compile-time by defining the ``_LIBCPP_VERBOSE_ABORT(format, args...)`` variadic macro. +overridden at compile time by defining the ``_LIBCPP_VERBOSE_ABORT(format, args...)`` variadic macro. When that macro is defined, it will be called with a format string as the first argument, followed by a series of arguments to format using printf-style formatting. Compile-time customization may be -interesting to get precise control over code generation, however it is also inconvenient to use in +useful to get precise control over code generation, however it is also inconvenient to use in some cases. Indeed, compile-time customization of the verbose termination function requires that all translation units be compiled with a consistent definition for ``_LIBCPP_VERBOSE_ABORT`` to avoid ODR violations, which can add complexity in the build system of users. Otherwise, if compile-time customization is not necessary, link-time customization of the handler is also possible, similarly to how replacing ``operator new`` works. This mechanism trades off fine-grained control -over the call site where the termination is initiated in exchange for more ergonomics. Link-time customization -is done by simply defining the following function in exactly one translation unit of your program: +over the call site where the termination is initiated in exchange for better ergonomics. Link-time +customization is done by simply defining the following function in exactly one translation unit of your +program: .. code-block:: cpp @@ -212,7 +190,7 @@ int main() { std::vector v; - int& x = v[0]; // Your termination function will be called here if _LIBCPP_ENABLE_ASSERTIONS=1 + int& x = v[0]; // Your termination function will be called here if the hardened mode or the debug mode is enabled. } Also note that the verbose termination function should never return. Since assertions in libc++ @@ -227,7 +205,7 @@ =========================== Libc++ provides a number of configuration macros which can be used to enable -or disable extended libc++ behavior, including enabling "debug mode" or +or disable extended libc++ behavior, including enabling the hardened mode or thread safety annotations. **_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS**: @@ -235,6 +213,12 @@ ``std::mutex`` and ``std::lock_guard``. By default, these annotations are disabled and must be manually enabled by the user. +**_LIBCPP_ENABLE_HARDENED_MODE**: + This macro is used to enable the :ref:`hardened mode `. + +**_LIBCPP_ENABLE_DEBUG_MODE**: + This macro is used to enable the :ref:`debug mode `. + **_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS**: This macro is used to disable all visibility annotations inside libc++. Defining this macro and then building libc++ with hidden visibility gives a diff --git a/libcxx/include/__assert b/libcxx/include/__assert --- a/libcxx/include/__assert +++ b/libcxx/include/__assert @@ -17,31 +17,21 @@ # pragma GCC system_header #endif -#ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS_DEFAULT -#endif - -#if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1 -# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1" -#endif +#define _LIBCPP_ASSERT(expression, message) \ + (__builtin_expect(static_cast(expression), 1) \ + ? (void)0 \ + : _LIBCPP_VERBOSE_ABORT( \ + "%s:%d: assertion %s failed: %s\n", __builtin_FILE(), __builtin_LINE(), #expression, message)) -#if _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ASSERT(expression, message) \ - (__builtin_expect(static_cast(expression), 1) \ - ? (void)0 \ - : _LIBCPP_VERBOSE_ABORT( \ - "%s:%d: assertion %s failed: %s\n", __builtin_FILE(), __builtin_LINE(), #expression, message)) // TODO: __builtin_assume can currently inhibit optimizations. Until this has been fixed and we can add // assumptions without a clear optimization intent, disable that to avoid worsening the code generation. // See https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609 for a discussion. -#elif 0 && __has_builtin(__builtin_assume) -# define _LIBCPP_ASSERT(expression, message) \ +#if 0 && __has_builtin(__builtin_assume) +# define _LIBCPP_ASSUME(expression) \ (_LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wassume") \ __builtin_assume(static_cast(expression)) _LIBCPP_DIAGNOSTIC_POP) #else -# define _LIBCPP_ASSERT(expression, message) ((void)0) +# define _LIBCPP_ASSUME(expression) ((void)0) #endif -#define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) - #endif // _LIBCPP___ASSERT diff --git a/libcxx/include/__config b/libcxx/include/__config --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -208,6 +208,19 @@ // HARDENING { +// TODO(hardening): remove this in LLVM 18. +// This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes) +// equivalent to setting the hardened mode. +# ifdef _LIBCPP_ENABLE_ASSERTIONS +# warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_ENABLE_HARDENED_MODE instead." +# if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1 +# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1" +# endif +# if _LIBCPP_ENABLE_ASSERTIONS +# define _LIBCPP_ENABLE_HARDENED_MODE 1 +# endif +# endif + // Enables the hardened mode which consists of all checks intended to be used in production. Hardened mode prioritizes // security-critical checks that can be done with relatively little overhead in constant time. Mutually exclusive with // `_LIBCPP_ENABLE_DEBUG_MODE`. @@ -245,26 +258,21 @@ // Hardened mode checks. # if _LIBCPP_ENABLE_HARDENED_MODE -// Automatically enable assertions in hardened mode (unless the user explicitly turned them off). -# ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS 1 -# endif - +// TODO(hardening): Once we categorize assertions, only enable the ones that we really want here. +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) // TODO(hardening): more checks to be added here... // Debug mode checks. # elif _LIBCPP_ENABLE_DEBUG_MODE -// Automatically enable assertions in debug mode (unless the user explicitly turned them off). -# ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS 1 -# endif - +// TODO(hardening): Once we categorize assertions, only enable the ones that we really want here. +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) // TODO(hardening): more checks to be added here... // Disable all checks if neither the hardened mode nor the debug mode is enabled. # else +# define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSUME(expression) // TODO: more checks to be added here... # endif // _LIBCPP_ENABLE_HARDENED_MODE diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in --- a/libcxx/include/__config_site.in +++ b/libcxx/include/__config_site.in @@ -28,7 +28,6 @@ #cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE #cmakedefine _LIBCPP_HAS_NO_LOCALIZATION #cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS -#cmakedefine01 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT // PSTL backends #cmakedefine _LIBCPP_PSTL_CPU_BACKEND_SERIAL diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt --- a/libcxx/test/CMakeLists.txt +++ b/libcxx/test/CMakeLists.txt @@ -24,10 +24,6 @@ serialize_lit_param(enable_rtti False) endif() -if (LIBCXX_ENABLE_ASSERTIONS) - serialize_lit_param(enable_assertions True) -endif() - serialize_lit_param(hardening_mode "\"${LIBCXX_HARDENING_MODE}\"") if (CMAKE_CXX_COMPILER_TARGET) diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -468,24 +468,6 @@ limit: 2 timeout_in_minutes: 120 - - label: "Assertions enabled" - command: "libcxx/utils/ci/run-buildbot generic-assertions" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - label: "Hardened mode" command: "libcxx/utils/ci/run-buildbot generic-hardened-mode" artifact_paths: diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -382,12 +382,6 @@ -DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in" check-runtimes ;; -generic-assertions) - clean - generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-assertions.cmake" - check-runtimes - check-abi-list -;; generic-hardened-mode) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardened-mode.cmake" @@ -495,7 +489,7 @@ # TODO: It would be better to run the tests against the fake-installed version of libc++ instead xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist ;; -apple-system-backdeployment-assertions-*) +apple-system-backdeployment-hardened-*) clean if [[ "${OSX_ROOTS}" == "" ]]; then @@ -506,7 +500,7 @@ curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}" fi - DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-assertions-}" + DEPLOYMENT_TARGET="${BUILDER#apple-system-backdeployment-hardened-}" # TODO: On Apple platforms, we never produce libc++abi.1.dylib or libunwind.1.dylib, # only libc++abi.dylib and libunwind.dylib. Fix that in the build so that the @@ -521,7 +515,7 @@ PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}" PARAMS+=";abi_runtime_root=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}" PARAMS+=";unwind_runtime_root=${OSX_ROOTS}/macOS/libunwind/${DEPLOYMENT_TARGET}" - PARAMS+=";enable_assertions=True" + PARAMS+=";hardening_mode=hardened" generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \ -DLIBCXX_TEST_CONFIG="apple-libc++-backdeployment.cfg.in" \ diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -283,18 +283,6 @@ help="Whether to enable tests that take longer to run. This can be useful when running on a very slow device.", actions=lambda enabled: [] if not enabled else [AddFeature("long_tests")], ), - Parameter( - name="enable_assertions", - choices=[True, False], - type=bool, - default=False, - help="Whether to enable assertions when compiling the test suite. This is only meaningful when " - "running the tests against libc++.", - actions=lambda assertions: [] if not assertions else [ - AddCompileFlag("-D_LIBCPP_ENABLE_ASSERTIONS=1"), - AddFeature("libcpp-has-assertions"), - ], - ), Parameter( name="hardening_mode", choices=["unchecked", "hardened", "debug"],