From: Mike Granby <mikeg@mikeg.net>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: [musl] sizeof(pthread_mutex_t) on aarch64
Date: Wed, 23 Aug 2023 02:09:35 +0000 [thread overview]
Message-ID: <MN2PR12MB30878759D59D4ED6F7AB6D0EAB1CA@MN2PR12MB3087.namprd12.prod.outlook.com> (raw)
I've been running glibc-compiled programs on Alpine and thus on musl with a high level of success, but I just hit the wall when working on a Raspberry PI running aarch64 Alpine. I tracked the issue down to a difference in the size of pthread_mutex_t. It appears that musl uses 6 ints for platforms with 32-bit longs, and 10 ints for those with 64-bit longs, and this seems to match glibc on all of the platforms I've played with to date. But on aarch64, it appears that glibc is using 48 bytes rather than 40 bytes that musl expects. This doesn't actually cause an issue in many cases as the application just allocates too much space, but if you're using inlining and std::ofstream, for example, you end up with the inline code in the application having a different layout for the file buffer object compared to that implemented on the target platform. Now, perhaps the answer is just, well, stop expecting to run glibc code on musl, but given that aarch64 seems to be an outlier in my experience to date, I thought I'd mention it.
Mike Granby
Granby Consulting LLC
next reply other threads:[~2023-08-23 2:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 2:09 Mike Granby [this message]
2023-08-23 13:29 ` Rich Felker
2023-08-23 13:57 ` Mike Granby
2023-08-23 20:04 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN2PR12MB30878759D59D4ED6F7AB6D0EAB1CA@MN2PR12MB3087.namprd12.prod.outlook.com \
--to=mikeg@mikeg.net \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).