-
Notifications
You must be signed in to change notification settings - Fork 93
platform: nsync futex: fix build on riscv32 #18
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
Conversation
|
Hi, thanks for the change. Two things:
Does the following change work for you? If so, could you use that instead? diff --git a/platform/linux/src/nsync_semaphore_futex.c b/platform/linux/src/nsync_semaphore_futex.c NSYNC_CPP_START_ +/* Linux uses 64-bit time when _TIME_BITS==64; only __NR_futex_time64 is
static int futex (int *uaddr, int op, int val, const struct timespec *timeout, int *uaddr2,
} /* Check that atomic operations on nsync_atomic_uint32_ can be applied to int. */ |
|
Github's text processing mangled my proposed change. Here's another try: |
|
Somehow you deleted the semicolon on the return statement (line 31). Could you add it and perhaps confirm that the code does in fact compile for 32-bit RISC-V Linux? Thanks. |
|
@m3bm3b yes I was trying to build, I will come back as soon as its working |
|
I managed to test the commit (with the semicolon added) under user-mode qemu-riscv32, (I tried to boot Linux using qemu-system-riscv32, but there seem to be many rough edges |
RISCV glibc has decided to use 64bit time_t from get go unlike other 32bit architecture therefore aliasing __NR_futex to __NR_futex_time64 helps avoid the below errors on rv32 error: '__NR_futex' was not declared in this scope | 21 | return (syscall (__NR_futex, uaddr, op, val, timeout, uaddr2, val3)); | |
m3bm3b
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks.
RISCV glibc has decided to use 64bit time_t from get go unlike other 32bit architecture therefore aliasing __NR_futex to __NR_futex_time64 helps avoid the below errors on rv32
error: '__NR_futex' was not declared in this scope
| 21 | return (syscall (__NR_futex, uaddr, op, val, timeout, uaddr2, val3));
| |
Issue linked to NobuoTsukamoto/meta-onnxruntime#3
@m3bm3b