[libcxx-commits] [PATCH] D84418: [libc++] Build the dylib with -faligned-allocation

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 23 08:10:24 PDT 2020


ldionne created this revision.
ldionne added reviewers: froydnj, dmajor.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, mgorny.
Herald added a project: libc++.
Herald added a reviewer: libc++.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84418

Files:
  libcxx/CMakeLists.txt


Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -526,6 +526,11 @@
     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++


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84418.280133.patch
Type: text/x-patch
Size: 752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200723/5ae48d16/attachment.bin>


More information about the libcxx-commits mailing list