[libc++] Build the dylib with -faligned-allocation

This avoids issues when building the dylib for deployment targets that
don't support aligned allocation, where Clang normally triggers an
error to warn users their code would break at runtime when back-deployed.
Since we're building the dylib itself, which contains the aligned
allocation functions, we don't want to trigger that error.

Differential Revision: https://reviews.llvm.org/D84418
This commit is contained in:
Louis Dionne 2020-07-23 11:05:47 -04:00
parent df441c9015
commit 918ba93367
1 changed files with 5 additions and 0 deletions

View File

@ -526,6 +526,11 @@ function(cxx_add_basic_build_flags target)
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO)
# When building the dylib, don't warn for unavailable aligned allocation
# functions based on the deployment target -- they are always available
# because they are provided by the dylib itself.
target_add_compile_flags_if_supported(${target} PRIVATE -faligned-allocation)
# On all systems the system c++ standard library headers need to be excluded.
# MSVC only has -X, which disables all default includes; including the crt.
# Thus, we do nothing and hope we don't accidentally include any of the C++