[PATCH] D100879: [Clang] Propagate guaranteed alignment for malloc and others

John McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 22 11:38:50 PST 2021


On Mon, Nov 22, 2021 at 2:28 PM John McCall <rjmccall at gmail.com> wrote:

> On Mon, Nov 22, 2021 at 1:08 PM David Goldblatt via Phabricator <
> reviews at reviews.llvm.org> wrote:
>
>> and related projects avoid relying on alignment guarantees (e.g.
>> libstdc++ at one point considered assuming that 8-byte allocs were 16-byte
>> aligned, and decided not to). At least one Linux distribution using clang
>> (Alpine) uses musl, which is a weak-alignment implementation (contrary to
>> what I claimed in N2293; I screwed up my background research).
>>
>
> If Alpine Linux wants to provide a weaker alignment guarantee than the
> "standard" Linux platform, they're entitled to.
>

I guess I should add that this would very arguably be ABI-incompatible and
could lead to problems running binaries built for Linux on other platforms
unless they statically link libc, but, well, that's an argument for Alpine
Linux to have with people interested in ensuring that there's a common
Linux platform.  Compilers are probably best off treating different Linux
distributions as independent platforms that happen to have a large amount
in common, similar to the BSDs except more so.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211122/5df17aa1/attachment.html>


More information about the cfe-commits mailing list