[libcxx-commits] [libcxx] 918ba93 - [libc++] Build the dylib with -faligned-allocation

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 23 11:04:07 PDT 2020


Author: Louis Dionne
Date: 2020-07-23T14:04:00-04:00
New Revision: 918ba933673a515240db867ce9467879ceb4da9f

URL: https://github.com/llvm/llvm-project/commit/918ba933673a515240db867ce9467879ceb4da9f
DIFF: https://github.com/llvm/llvm-project/commit/918ba933673a515240db867ce9467879ceb4da9f.diff

LOG: [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

Added: 
    

Modified: 
    libcxx/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 5fa3b66c99a7..fd877f1adaeb 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -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++


        


More information about the libcxx-commits mailing list