Skip to content

newlib: correct RTEMS scalar type widths - #5450

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
physwkim:rtems-scalar-widths
Aug 31, 2026
Merged

tgross35 merged 1 commit into
rust-lang:mainfrom
physwkim:rtems-scalar-widths

Conversation

@physwkim

@physwkim physwkim commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

This picks up where #5308 left off. RTEMS defines dev_t, ino_t and
clock_t as 64-bit, rlim_t as signed 64-bit, and clockid_t as a signed
int (newlib's <machine/_types.h>), but libc currently has them all
32-bit and clockid_t unsigned. time_t and off_t from #5308 are already
correct on main, so only the remaining five are touched here.

Definitions in RTEMS's newlib, at the commit the RTEMS 7 tools pin
(newlib/libc/sys/rtems/include/machine/_types.h):

@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.

Looks probably fine but could you please add permalinks?

View changes since this review

@rustbot

rustbot commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

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

@physwkim

Copy link
Copy Markdown
Contributor Author

@rustbot ready

Comment thread src/unix/newlib/rtems/mod.rs Outdated
Comment on lines +3 to +5
// RTEMS defines `clock_t` as `__uint64_t` (`<machine/_types.h>` via
// `<sys/types.h>`), not `long` as plain newlib arm targets did.
pub type clock_t = c_ulonglong;

@tgross35 tgross35 Aug 31, 2026 •

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.

RTEMS's newlib defines these in <machine/_types.h>: __dev_t, __ino_t
and _CLOCK_T_ as __uint64_t, __rlim_t as __int64_t, _CLOCKID_T_ as int
— where this tree has them 32-bit, and clockid_t unsigned. Verified
with _Static_assert under both arm-rtems6-gcc and arm-rtems7-gcc.

Source: https://github.com/RTEMS/sourceware-mirror-newlib-cygwin/blob/7d4336cf6e519c2a4c9baac10da7a785d88d30c5/newlib/libc/sys/rtems/include/machine/_types.h#L12-L39
@physwkim
physwkim force-pushed the rtems-scalar-widths branch from 149d9af to 85e964e Compare August 31, 2026 09:09
@physwkim

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.

CC maintainer @thesummer but LGTM!

View changes since this review

@tgross35
tgross35 enabled auto-merge August 31, 2026 09:13
@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Aug 31, 2026
@tgross35
tgross35 added this pull request to the merge queue Aug 31, 2026
Merged via the queue into rust-lang:main with commit 7c1cc59 Aug 31, 2026
58 checks passed
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
RTEMS's newlib defines these in <machine/_types.h>: __dev_t, __ino_t
and _CLOCK_T_ as __uint64_t, __rlim_t as __int64_t, _CLOCKID_T_ as int
— where this tree has them 32-bit, and clockid_t unsigned. Verified
with _Static_assert under both arm-rtems6-gcc and arm-rtems7-gcc.

Source: https://github.com/RTEMS/sourceware-mirror-newlib-cygwin/blob/7d4336cf6e519c2a4c9baac10da7a785d88d30c5/newlib/libc/sys/rtems/include/machine/_types.h#L12-L39

(backport <rust-lang#5450>)
(cherry picked from commit 7c1cc59)
@tgross35 tgross35 mentioned this pull request Sep 4, 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 4, 2026
tgross35 pushed a commit to tgross35/rust-libc that referenced this pull request Sep 4, 2026
RTEMS's newlib defines these in <machine/_types.h>: __dev_t, __ino_t
and _CLOCK_T_ as __uint64_t, __rlim_t as __int64_t, _CLOCKID_T_ as int
— where this tree has them 32-bit, and clockid_t unsigned. Verified
with _Static_assert under both arm-rtems6-gcc and arm-rtems7-gcc.

Source: https://github.com/RTEMS/sourceware-mirror-newlib-cygwin/blob/7d4336cf6e519c2a4c9baac10da7a785d88d30c5/newlib/libc/sys/rtems/include/machine/_types.h#L12-L39

(backport <rust-lang#5450>)
(cherry picked from commit 7c1cc59)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-newlib 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.

3 participants