Re: [PATCH v6] rust: alloc: satisfy POSIX alignment requirement
From: Gary Guo
Date: Thu Feb 13 2025 - 09:23:32 EST
On Thu, 13 Feb 2025 06:33:58 -0500
Tamir Duberstein <tamird@xxxxxxxxx> wrote:
> On Thu, Feb 13, 2025 at 6:30 AM Gary Guo <gary@xxxxxxxxxxx> wrote:
> >
> > On Thu, 13 Feb 2025 06:26:41 -0500
> > Tamir Duberstein <tamird@xxxxxxxxx> wrote:
> >
> > > ISO C's `aligned_alloc` is partially implementation-defined; on some
> > > systems it inherits stricter requirements from POSIX's `posix_memalign`.
> > >
> > > This causes the call added in commit dd09538fb409 ("rust: alloc:
> > > implement `Cmalloc` in module allocator_test") to fail on macOS because
> > > it doesn't meet the requirements of `posix_memalign`.
> > >
> > > Adjust the call to meet the POSIX requirement and add a comment. This
> > > fixes failures in `make rusttest` on macOS.
> > >
> > > Acked-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> > > Fixes: dd09538fb409 ("rust: alloc: implement `Cmalloc` in module allocator_test")
> > > Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
> > > ---
> > > Changes in v6:
> > > - Replace unsound use of build_error with map_err. (Danilo Krummrich)
> >
> > It's sound, just not correct.
>
> Changed. I asked a tangential question in the last thread but: do you
> think it's possible to make build_error work correctly on the host?
I don't know what would be needed to make it work off the top of my
head.
Maybe it could be done, but I don't think it's worth the effort since
it's only used for host side test.
- Gary