Bug 1480834 - 3. Fix linker compile errors under x86-64; r=glandium

The linker has x86-64 support but currently fails to compile. This patch
fixes these compile errors to make it build under x86-64.

Differential Revision: https://phabricator.services.mozilla.com/D4481
This commit is contained in:
Jim Chen 2018-09-13 12:09:25 -04:00
parent d968bd5148
commit d92debaff7

View File

@ -284,8 +284,8 @@ public:
length, str, buf);
return new _MappableBuffer(fd.forget(), buf, length);
}
#elif defined(__i386__) || defined(__aarch64__)
// Address decreases on x86 and AArch64.
#elif defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
// Address decreases on x86, x86-64, and AArch64.
size_t anon_mapping_length = length + PAGE_SIZE;
void *buf = ::mmap(nullptr, anon_mapping_length, PROT_NONE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@ -350,7 +350,7 @@ public:
/* Free the additional page we allocated. See _MappableBuffer::Create */
#if defined(__arm__)
::munmap(AlignedEndPtr(*this + GetLength(), PAGE_SIZE), PAGE_SIZE);
#elif defined(__i386__) || defined(__aarch64__)
#elif defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
::munmap(*this - PAGE_SIZE, GetLength() + PAGE_SIZE);
#else
#error need to add a case for your CPU