Skip to content

Commit

Permalink
Use mmap64 on Linux.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Michael Benfield committed Dec 6, 2022
1 parent 5be2e8b commit 788682a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/symbolize/gimli/mmap_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ 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,
}

impl Mmap {
pub unsafe fn map(file: &File, len: usize) -> Option<Mmap> {
let ptr = libc::mmap(
let ptr = mmap64(
ptr::null_mut(),
len,
libc::PROT_READ,
Expand Down

0 comments on commit 788682a

Please sign in to comment.