Skip to content

Non-LFS functions on 32-bit platforms #94173

Closed
@vt-alt

Description

@vt-alt

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:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions