Skip to content

Commit

Permalink
Use mmap64 on Linux with glibc.
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
mikebenfield committed Dec 26, 2022
1 parent 8ad84ca commit 062e784
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(not(all(target_os = "linux", target_env = "gnu")))]
use libc::mmap as mmap64;
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use libc::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 062e784

Please sign in to comment.