Skip to content
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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Commits on Aug 15, 2024

  1. Add cfg option gnu_time64_abi

    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.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    ee04e86 View commit details
    Browse the repository at this point in the history
  2. libc-test: Set the gnu time64 preprocessor symbols for all ptr32

    Set _TIME_BITS=64 and _FILE_OFFSET_BITS=64 preprocessor symbols for
    the C test code as for building the code.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    6e9fa92 View commit details
    Browse the repository at this point in the history
  3. gnu: Handle basic file and time types for 32bit systems with time64

    Set the basic types correctly for gnu_time64_abi (_TIME_BITS=64 and
    _FILE_OFFSET_BITS=64).
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    6b82eb2 View commit details
    Browse the repository at this point in the history
  4. gnu: Use _TIME_BITS and _FILE_OFFSET_BITS=64 versions of glibc symbols

    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.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    107177a View commit details
    Browse the repository at this point in the history
  5. linux: Set SO_TIMESTAMP* and SO_RCVTIMEO and SO_SNDTIMEO

    The actual values may be different on 32bit archs and glibc with
    64-bit time.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    5a0eb4b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9c46b6c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ecf680c View commit details
    Browse the repository at this point in the history
  8. gnu: Update F_SETLK and F_SETLKW for 64-bit time

    Also add the F_[SG]ET*64 constants.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    8f514a1 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    5213d0b View commit details
    Browse the repository at this point in the history
  10. gnu: Handle timeval.tv_usec for glibc 64-bit time_t

    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.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    50a931d View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    c4a27a8 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    d2af68c View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    bc553de View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    f2ff593 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    83c60cd View commit details
    Browse the repository at this point in the history
  16. gnu: Update struct timespec for _TIME_BITS=64

    Big-endian platforms wants 32 bits of padding before tv_nsec,
    little-endian after.
    
    GNU libc always uses long for tv_nsec.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    49d1137 View commit details
    Browse the repository at this point in the history
  17. gnu: Move struct timex to gnu/b64 and gnu/b32/time*.rs

    Do not use gnu/b32/time*.rs for riscv32 and sparc.  Add timex to
    gnu/b32/(riscv32|sparc)/mod.rs instead.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    fefc83c View commit details
    Browse the repository at this point in the history
  18. gnu: Update the stat* structs for 64-bit time

    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.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    d9a25a7 View commit details
    Browse the repository at this point in the history
  19. full_ci: Test with various _TIME_BITS settings where relevant

    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.
    snogge committed Aug 15, 2024
    Configuration menu
    Copy the full SHA
    1db367e View commit details
    Browse the repository at this point in the history