C++17 defines the C11 aligned_alloc, so we can use that instead of
posix_memalign. This change allows building against picolibc without
defining _DEFAULT_SOURCE/_GNU_SOURCE.
The C11 aligned_alloc function should be available on all supported
non-Windows platforms except for macOS where we need version 10.15.
There is one caveat: aligned_alloc() requires that size is a multiple of
alignment, but [new.delete.general] only states "if the value of an
alignment argument passed to any of these functions is not a valid
alignment value, the behavior is undefined".
To handle calls such as ::operator new(1, std::align_val_t(128)), we
round up size to alignment (and check for wrap-around).
This is required at least for macOS where aligned_alloc(128, 1) returns
an error instead of allocating memory (glibc ignores the specification).
I think this actually started in macOS 10.15, it's just that our back-deployment CI does not run for all versions between 10.9 and 10.15.