Skip to content

linux: fix unusable riscv32 GNU syscall numbers - #5455

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
xjtu-ctgg:fix-riscv32-gnu-time64-syscalls-5379
Sep 7, 2026
Merged

tgross35 merged 1 commit into
rust-lang:mainfrom
xjtu-ctgg:fix-riscv32-gnu-time64-syscalls-5379

Conversation

@xjtu-ctgg

@xjtu-ctgg xjtu-ctgg commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fix the syscall definitions for riscv32gc-unknown-linux-gnu.

RISC-V 32-bit does not provide the old time32 syscall implementations. This updates the GNU riscv32 module to use the corresponding time64 syscall numbers and removes the generic names that refer to unavailable time32 syscalls.

Closes #5379

Sources

Tests

  • cargo +nightly-2026-08-23 test --workspace
  • python3 ci/verify-build.py --toolchain nightly-2026-08-23 --only riscv32gc-unknown-linux-gnu
  • cargo +nightly-2026-08-23 fmt --check
  • git diff --check

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rustbot

This comment has been minimized.

@xjtu-ctgg
xjtu-ctgg force-pushed the fix-riscv32-gnu-time64-syscalls-5379 branch from f2e3ed9 to 6d8d553 Compare August 31, 2026 16:31
@rustbot

This comment has been minimized.

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the values like SYS_futex not usable at all in C? riscv32gc-unknown-linux-* are T3 so they can be removed or deprecated first rather than aliased.

View changes since this review

Comment on lines +758 to +777

// Plain syscalls aliased to their time64 variants
pub const SYS_clock_gettime: c_long = SYS_clock_gettime64;
pub const SYS_clock_settime: c_long = SYS_clock_settime64;
pub const SYS_clock_adjtime: c_long = SYS_clock_adjtime64;
pub const SYS_clock_getres: c_long = SYS_clock_getres_time64;
pub const SYS_clock_nanosleep: c_long = SYS_clock_nanosleep_time64;
pub const SYS_timer_gettime: c_long = SYS_timer_gettime64;
pub const SYS_timer_settime: c_long = SYS_timer_settime64;
pub const SYS_timerfd_gettime: c_long = SYS_timerfd_gettime64;
pub const SYS_timerfd_settime: c_long = SYS_timerfd_settime64;
pub const SYS_utimensat: c_long = SYS_utimensat_time64;
pub const SYS_pselect6: c_long = SYS_pselect6_time64;
pub const SYS_ppoll: c_long = SYS_ppoll_time64;
pub const SYS_recvmmsg: c_long = SYS_recvmmsg_time64;
pub const SYS_mq_timedsend: c_long = SYS_mq_timedsend_time64;
pub const SYS_mq_timedreceive: c_long = SYS_mq_timedreceive_time64;
pub const SYS_rt_sigtimedwait: c_long = SYS_rt_sigtimedwait_time64;
pub const SYS_futex: c_long = SYS_futex_time64;
pub const SYS_sched_rr_get_interval: c_long = SYS_sched_rr_get_interval_time64;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you preserve the existing ordering?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated. The generic names are now removed rather than aliased, and the *_time64 constants stay in their original positions. I also rebased onto the latest main. (^^;

@rustbot

rustbot commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@xjtu-ctgg
xjtu-ctgg force-pushed the fix-riscv32-gnu-time64-syscalls-5379 branch from 6d8d553 to 4fe2850 Compare September 1, 2026 01:41
@rustbot

rustbot commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@xjtu-ctgg

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@tgross35 tgross35 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM: in the kernel's unistd.h all removed constants are gated by #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32, and this matches the glibc file. Thanks!

View changes since this review

@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Sep 7, 2026
@tgross35
tgross35 enabled auto-merge September 7, 2026 04:22
@tgross35
tgross35 added this pull request to the merge queue Sep 7, 2026
Merged via the queue into rust-lang:main with commit 181ab01 Sep 7, 2026
108 of 115 checks passed
@tgross35

tgross35 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Are you developing for this platform? I would love to have some downstream CI, rv32-linux is very breakage prone because it's the one target that is 64-bit time_t by default at a time when we're trying to get our ducks in a row with that.

See #5209 for instructions if you might be able to set something up

@xjtu-ctgg

Copy link
Copy Markdown
Contributor Author

Thanks! I'm not currently developing on rv32 Linux, so I don't have a downstream environment I can reliably maintain.

@tgross35

tgross35 commented Sep 7, 2026

Copy link
Copy Markdown
Member

For what it's worth, if you're able to run the target in docker+qemu that's enough. We just can't do that in this repo because of the target tier policy

@tgross35 tgross35 mentioned this pull request Sep 17, 2026
renovate-bot pushed a commit to renovate-bot/rust-lang-_-libc that referenced this pull request Sep 17, 2026
@tgross35 tgross35 added stable-applied This PR has been cherry-picked to libc's stable release branch and removed stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-gnu O-linux O-linux-like O-riscv O-unix stable-applied This PR has been cherry-picked to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unusable syscall numbers defined for riscv32gc-unknown-linux-gnu

4 participants