From 788682a338dd4012e29c0c17de9bc8b4c0d8e734 Mon Sep 17 00:00:00 2001 From: Michael Benfield Date: Tue, 6 Dec 2022 20:58:12 +0000 Subject: [PATCH] Use mmap64 on Linux. mmap is a non-LFS function and due to its usage here will appear in binaries produced by rustc. This is relevant to rust-lang/rust#94173. --- src/symbolize/gimli/mmap_unix.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/symbolize/gimli/mmap_unix.rs b/src/symbolize/gimli/mmap_unix.rs index 5806c9f7e..b0f5064f6 100644 --- a/src/symbolize/gimli/mmap_unix.rs +++ b/src/symbolize/gimli/mmap_unix.rs @@ -4,6 +4,11 @@ use core::ops::Deref; use core::ptr; use core::slice; +#[cfg(target_os = "linux")] +use libc::mmap64; +#[cfg(not(target_os = "linux"))] +use libc::mmap as mmap64; + pub struct Mmap { ptr: *mut libc::c_void, len: usize, @@ -11,7 +16,7 @@ pub struct Mmap { impl Mmap { pub unsafe fn map(file: &File, len: usize) -> Option { - let ptr = libc::mmap( + let ptr = mmap64( ptr::null_mut(), len, libc::PROT_READ,