1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:27:45 +00:00

LibELF: Don't try to call mremap() on macOS

There is no mremap() on macOS. I'm just #ifdef'ing out the call here
since I don't think the dynamic loader code matters on macOS anyway.
This commit is contained in:
Andreas Kling 2020-12-29 10:55:35 +01:00
parent d0363bca01
commit 5c99296b92

View file

@ -185,11 +185,13 @@ bool DynamicLoader::load_stage_2(unsigned flags, size_t total_tls_size)
// dbg() << "Someone linked non -fPIC code into " << m_filename << " :("; // dbg() << "Someone linked non -fPIC code into " << m_filename << " :(";
ASSERT(m_text_segment_load_address.get() != 0); ASSERT(m_text_segment_load_address.get() != 0);
#ifndef AK_OS_MACOS
// Remap this text region as private. // Remap this text region as private.
if (mremap(m_text_segment_load_address.as_ptr(), m_text_segment_size, m_text_segment_size, MAP_PRIVATE) == MAP_FAILED) { if (mremap(m_text_segment_load_address.as_ptr(), m_text_segment_size, m_text_segment_size, MAP_PRIVATE) == MAP_FAILED) {
perror("mremap .text: MAP_PRIVATE"); perror("mremap .text: MAP_PRIVATE");
return false; return false;
} }
#endif
if (0 > mprotect(m_text_segment_load_address.as_ptr(), m_text_segment_size, PROT_READ | PROT_WRITE)) { if (0 > mprotect(m_text_segment_load_address.as_ptr(), m_text_segment_size, PROT_READ | PROT_WRITE)) {
perror("mprotect .text: PROT_READ | PROT_WRITE"); // FIXME: dlerror? perror("mprotect .text: PROT_READ | PROT_WRITE"); // FIXME: dlerror?