Description
As of 1.58.1 rustc compiles with non-LFS functions on 32-bit platforms.
Linux kernel have special 64-bit versions of some important syscalls that 32-bit programs could use if they want to access large files. In C (and glibc) there is transparent function & syscall replacement if program is compiled with -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
.
Example list of functions that should not be used and replaced with their 64-bit versions if LFS is enabled: fallocate fcntl fopen fstat fstatfs ftruncate getrlimit glob globfree lseek lstat mkstemp mmap open openat posix_fadvise posix_fallocate pread pwrite readdir setrlimit stat statfs
. For example, instead of openat
should be used openat64
.
There are related issues:
- std: use more LFS functions on Linux #31668
- std: Use Android LFS off64_t, ftruncate64, and lseek64 #31805
But their solutions are seems incomplete.
Simplest reproducer:
$ cat main.rs
fn main() {}
$ rustc main.rs
$ nm main |grep 'U open'
U open64@GLIBC_2.1
U open@GLIBC_2.0
As you can see there is open
present which mean that there is still non-LFS compliant usage.