summaryrefslogtreecommitdiff
path: root/src/pal/src/map
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2017-05-09 20:30:59 +0200
committerGitHub <noreply@github.com>2017-05-09 20:30:59 +0200
commit1ce30c0e3b17555459b936fe61f527b175b0035e (patch)
tree09bca9289d821bbd3c48448eeaff4bc28bd0e081 /src/pal/src/map
parent4f6fe878d7dfe2a148252eecc672981eedda1f1c (diff)
downloadcoreclr-1ce30c0e3b17555459b936fe61f527b175b0035e.tar.gz
coreclr-1ce30c0e3b17555459b936fe61f527b175b0035e.tar.bz2
coreclr-1ce30c0e3b17555459b936fe61f527b175b0035e.zip
Stop loading crossgen-ed binaries at preferred address on Unix (#11467)
This change removes attempt to load crossgen-ed binaries at preferred address on Unix and uses whatever address the mmap returns instead.
Diffstat (limited to 'src/pal/src/map')
-rw-r--r--src/pal/src/map/map.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/pal/src/map/map.cpp b/src/pal/src/map/map.cpp
index f3172c3bbc..f26293bea3 100644
--- a/src/pal/src/map/map.cpp
+++ b/src/pal/src/map/map.cpp
@@ -2440,22 +2440,21 @@ void * MAPMapPEFile(HANDLE hFile)
// We're going to start adding mappings to the mapping list, so take the critical section
InternalEnterCriticalSection(pThread, &mapping_critsec);
-#if !defined(_AMD64_)
- loadedBase = mmap((void*)preferredBase, virtualSize, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
-#else // defined(_AMD64_)
+#ifdef BIT64
// First try to reserve virtual memory using ExecutableAllcator. This allows all PE images to be
// near each other and close to the coreclr library which also allows the runtime to generate
// more efficient code (by avoiding usage of jump stubs). Alignment to a 64 KB granularity should
// not be necessary (alignment to page size should be sufficient), but see
// ExecutableMemoryAllocator::AllocateMemory() for the reason why it is done.
loadedBase = ReserveMemoryFromExecutableAllocator(pThread, ALIGN_UP(virtualSize, VIRTUAL_64KB));
+#endif // BIT64
+
if (loadedBase == NULL)
{
// MAC64 requires we pass MAP_SHARED (or MAP_PRIVATE) flags - otherwise, the call is failed.
// Refer to mmap documentation at http://www.manpagez.com/man/2/mmap/ for details.
- loadedBase = mmap((void*)preferredBase, virtualSize, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
+ loadedBase = mmap(NULL, virtualSize, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
}
-#endif // !defined(_AMD64_)
if (MAP_FAILED == loadedBase)
{