-
Notifications
You must be signed in to change notification settings - Fork 399
Fix assembly for x32 ABI #438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
I'll be honest, I thought x32 had been deprecated years ago. Is this something popular enough to warrant support? |
Gentoo does support it and I'm using it. |
What would be our options for CI testing this? Apart from what GH Actions provides directly, we use QEMU via cross-rs to test esoteric architectures (big endian etc.), but it doesn't look like cross-rs supports x32. |
It seems like you are using Ubuntu: it has x32 support in regular x86_64 releases. (There are packages like gcc-13-x86-64-linux-gnux32, libc6-x32, binutils-x86-64-linux-gnux32 etc). One way to provide correct compiler for the build system is to use CMake's toolchain file ( https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html Basically you need a regular amd64 kernel with CONFIG_X86_X32=y and a toolchain. Regular amd64 ABI and x32 ABI can coexist (together with i686 ABI) on the same machine. |
Can repro the fix on my SSE2-capable x32 machine:
for #include <stdio.h>
#include "blake3.h"
static uint8_t data[1024 * 1024 * 100];
int main() {
blake3_hasher h;
blake3_hasher_init(&h);
blake3_hasher_update(&h, data, sizeof(data));
blake3_hasher_finalize(&h, data, 256);
for(int i = 0; i < 256; ++i)
printf("%02x", data[i]);
putchar('\n');
} |
Another option might be to just fall back to the intrinsics implementation on x32? Am I right to think that those should actually work? |
I had not seen that this PR was already here when I submitted #500, apologies. In my PR, note the additional |
The x32 ABI is special ABI for long mode on x64, that uses 32 bit integers and pointers instead of 64 bit. This patch fixes assembly code for x32 ABI.
See https://bugs.gentoo.org/942562
https://wiki.debian.org/X32Port