[libcxx-commits] [PATCH] D129842: [libcxxabi] Fix alignment of pointers returned by fallback_malloc

Simon Tatham via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 15 02:38:09 PDT 2022


simon_tatham created this revision.
simon_tatham added reviewers: EricWF, compnerd, jroelofs, joerg, miyuki, ldionne.
Herald added a project: All.
simon_tatham requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.

This aligns the ``heap[]`` array in ``fallback_malloc.cpp`` to ensure
that it can be safely cast to ``heap_node*``, and also adjusts the
allocation algorithm to ensure that every allocated block has the
alignment requested by ``__attribute__((aligned))``, by putting the
block's ``heap_node`` header 4 bytes before an aligned address.

Patch originally by Eric Fiselier: this is an updated version of
D12669 <https://reviews.llvm.org/D12669>, which was never landed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129842

Files:
  libcxxabi/src/fallback_malloc.cpp
  libcxxabi/test/test_fallback_malloc.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129842.444920.patch
Type: text/x-patch
Size: 6088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220715/8a0f3d6d/attachment.bin>


More information about the libcxx-commits mailing list