Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang arm cross compile issue #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions jemalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ fn main() {
.env("CPPFLAGS", cflags.clone())
.arg("--disable-cxx");

// if the compiler is clang, add -E to run the preprocessor when configure checks it
if let Some(compiler_path) = compiler.path().to_str() {
if compiler_path.contains("clang") {
cmd.env("CPP", compiler_path.to_owned() + " -E");
}
}

if target.contains("ios") {
// newer iOS deviced have 16kb page sizes:
// closed: https://github.com/gnzlbg/jemallocator/issues/68
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ macro_rules! assume {
if !($e) {
core::hint::unreachable_unchecked();
}
}
};
}

/// Handle to the jemalloc allocator
Expand Down Expand Up @@ -122,7 +122,7 @@ unsafe impl GlobalAlloc for Jemalloc {

#[inline]
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
assume!(!ptr.is_null())
assume!(!ptr.is_null());
assume!(layout.size() != 0);
let flags = layout_to_flags(layout.align(), layout.size());
ffi::sdallocx(ptr as *mut c_void, layout.size(), flags)
Expand Down