-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Switch to 64 bit file and time APIs on GNU libc for 32bit systems #3175
base: main
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Oops, left some debug/test commits in there. Removed now. |
Hi @JohnTitor , do you have any feedback on this change?
I'm not a Rust developer and not sure how I can create that type alias. |
☔ The latest upstream changes (presumably #3218) made this pull request unmergeable. Please resolve the merge conflicts. |
5dfc8ed
to
7d2c859
Compare
Thanks for the PR! But I think this is a huge breaking change and we have to discuss it before reviewing the changes (or, even submitting a PR). Could you open an issue instead? |
Sure, I'll do that. |
I'm working on updating this PR to handle problem 2 mentioned above and to pass tests on more platforms. Expect an update later this week. |
5314484
to
eb997cb
Compare
Sorry for the many pushes, that was meant only for my fork. Anyway, now the PR should handle the duplicate functions mentioned in problem 2, and also pass tests on more platforms. |
☔ The latest upstream changes (presumably #3237) made this pull request unmergeable. Please resolve the merge conflicts. |
Just rebased on main. Passes all tests in main.yml and bors.yml workflows. I considered adding a cargo feature to control this, but as that would be braking the ABI I guess I shouldn't? |
☔ The latest upstream changes (presumably #3437) made this pull request unmergeable. Please resolve the merge conflicts. |
299e6da
to
473fcae
Compare
This is great!
I don't see what we can do about this.
I have no idea why glibc did not choose to redefine
Not going via
https://salsa.debian.org/rust-team/debcargo-conf/-/blob/master/src/libpulse-binding/debian/patches/avoid-suseconds_t.patch#L34
https://salsa.debian.org/rust-team/debcargo-conf/-/blob/master/src/nix/debian/patches/time_t_workarounds.diff#L66
I've pushed the new input_event struct that looks like (except for conditionals and stuff) pub struct input_event {
pub input_event_sec: ::time_t,
pub input_event_sec: ::c_ulong,
}; I think it is correct for all archs, I cannot figure out any where it shouldn't be.
Just use the
|
@plugwash, I reread your comment about this, and I now I can figure out where it wouldn't work. :) |
The gnu_time64_abi option indicates that a 32-bit arch should use 64-bit time_t and 64-bit off_t and simliar file related types. 32-bit platforms are identified by CARGO_CFG_TARGET_POINTER_WIDTH, but x86_64-unknown-linux-gnux32 is a 64-bit platform and should not use gnu_time64_abi even if it has 32-bit pointers. riscv32 is a 32-bit platform but has always used 64-bit types for time and file operations. It should not use the gnu_time64_abi The default - all relevant platforms should use 64-bit time - can be overridden by setting the RUST_LIBC_TIME_BITS environment variable to 32. It can also be set to 64 to force gnu_time64_abi, or default which is the same as leaving it unset. The last two options are mainly useful for CI flows.
Set _TIME_BITS=64 and _FILE_OFFSET_BITS=64 preprocessor symbols for the C test code as for building the code.
Set the basic types correctly for gnu_time64_abi (_TIME_BITS=64 and _FILE_OFFSET_BITS=64).
Set the link names of relevant symbols to use be the same as when a C program is built against GNU libc with -D_TIME_BITS=64 and -D_FILE_OFFSET_BITS=64.
The actual values may be different on 32bit archs and glibc with 64-bit time.
Also add the F_[SG]ET*64 constants.
For 64 bit time on 32 bit linux glibc timeval.tv_usec is actually __suseconds64_t (64 bits) while suseconds_t is still 32 bits.
Big-endian platforms wants 32 bits of padding before tv_nsec, little-endian after. GNU libc always uses long for tv_nsec.
Do not use gnu/b32/time*.rs for riscv32 and sparc. Add timex to gnu/b32/(riscv32|sparc)/mod.rs instead.
Move the stat struct from gnu/b32/mod.rs to gnu/b32/time*.rs For arm, mips, powerpc, riscv32, and x86, move stat64 to time32.rs and add an stat64 = stat alias to time64.rs. For sparc, do the same for statfs64 and statvfs64.
In Linux Tier1, run the tests for i686-unknown-linux-gnu with RUST_LIBC_TIME_BITS set to 32, 64, and default. In Linux Tier2, run the tests for arm-unknown-linux-gnueabihf and powerpc-unknown-linux-gnu with RUST_LIBC_TIME_BITS set to 32, 64, and default. Use RUST_LIBC_TIME_BITS=defaults for the other platforms. In Build Channels Linux, build the relevant platforms with RUST_LIBC_TIME_BITS unset and set to 32 and 64.
@JohnTitor @tgross35 @joshtriplett |
@snogge thank you for the change and for being willing to keep up with it. We need this change and I think something like this may be about the only reasonable approach. I looked at this and have some small feedback, but I need to double check with the libs team that this is the path we want/need to go. I'm going to try to get a meeting scheduled for this which will probably take about a month, after that we will know what is needed to get this merged. Hold off on any rebases until then just in case, but I think we will still want most of this even if something like the config has to change. |
@tgross35 Any updates? It's been almost two months now. |
Use the 64 bit types and APIs included in GNU libc also for 32-bit systems. These are the types and APIs used when you compile your C code against GNU libc headers with the preprocessor options -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64.
This is required for 2038 compatible software built for 32-bit systems.
This PR is not done, I need some guidance with finishing it.
struct stat
andstruct stat64
be different names for the same struct. I don't know how to do that.I've done one commit for each modified type so it is easier to review the changes in isolation.