[all-commits] [llvm/llvm-project] a771a9: [libcxxabi] Fix alignment of pointers returned by ...

Simon Tatham via All-commits all-commits at lists.llvm.org
Fri Aug 19 07:08:53 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a771a91dcbe637bc545da510fe5a9a671ab5e977
  Author: Simon Tatham <simon.tatham at arm.com>
  Date:   2022-08-19 (Fri, 19 Aug 2022)

  Changed paths:
    M libcxxabi/src/fallback_malloc.cpp
    M libcxxabi/test/test_fallback_malloc.pass.cpp

  Log Message:
  [libcxxabi] Fix alignment of pointers returned by fallback_malloc

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, which was never landed.

Reviewed By: ldionne, #libc_abi

Differential Revision: https://reviews.llvm.org/D129842

More information about the All-commits mailing list