Skip to content

Commit

Permalink
[libc++][libc++abi] Build with -fsized-deallocation
Browse files Browse the repository at this point in the history
This patch makes libc++ and libc++abi build with -fsized-deallocation.
That flag is enabled by default in recent versions of Clang, so this
patch will make these runtimes forward-compatible with ToT Clang.
  • Loading branch information
ldionne committed Jun 20, 2024
1 parent ace069d commit 77b9cce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ function(cxx_add_basic_build_flags target)
target_add_compile_flags_if_supported(${target} PRIVATE -fvisibility=hidden)
endif()

# Build with -fsized-deallocation, which is default in recent versions of Clang.
# TODO(LLVM 21): This can be dropped once we only support Clang >= 19.
target_compile_options(${target} PRIVATE -fsized-deallocation)

# Let the library headers know they are currently being used to build the
# library.
target_compile_definitions(${target} PRIVATE -D_LIBCPP_BUILDING_LIBRARY)
Expand Down
4 changes: 4 additions & 0 deletions libcxxabi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ endif()
add_compile_flags("${LIBCXXABI_ADDITIONAL_COMPILE_FLAGS}")
add_library_flags("${LIBCXXABI_ADDITIONAL_LIBRARIES}")

# Build with -fsized-deallocation, which is default in recent versions of Clang.
# TODO(LLVM 21): This can be dropped once we only support Clang >= 19.
add_compile_flags(-fsized-deallocation)

# Configure compiler. Must happen after setting the target flags.
include(config-ix)

Expand Down

0 comments on commit 77b9cce

Please sign in to comment.