Move the ILP32 mremap() hackery into legacy_32_bit_support.cpp.

Similar to mmap(), this confuses me every time I look at it. Move it out
of the way, and make it clearer that this is just junk that can be
deleted when we remove 32-bit support.

Also improve coverage by adding a test for the varargs special case.

Test: treehugger
Merged-in: Ia375c29d18e31e646b795e643534f0be07d382b9
Change-Id: Ia375c29d18e31e646b795e643534f0be07d382b9
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index ce14e49..a8c70e5 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -118,7 +118,6 @@
 pid_t       __getpid:getpid()  all
 int memfd_create(const char*, unsigned) all
 int         munmap(void*, size_t)  all
-void*       __mremap:mremap(void*, size_t, size_t, int, void*)  all
 int         msync(const void*, size_t, int)    all
 int         mprotect(const void*, size_t, int)  all
 int         madvise(void*, size_t, int)  all
@@ -190,6 +189,10 @@
 void* __mmap2:mmap2(void*, size_t, int, int, int, long) lp32
 void* mmap|mmap64(void*, size_t, int, int, int, off_t) lp64
 
+# mremap is in C++ for 32-bit so we can add the PTRDIFF_MAX check.
+void* __mremap:mremap(void*, size_t, size_t, int, void*) lp32
+void* mremap(void*, size_t, size_t, int, void*) lp64
+
 # posix_fadvise64 is awkward: arm has shuffled arguments,
 # the POSIX functions don't set errno, and no architecture has posix_fadvise.
 int __arm_fadvise64_64:arm_fadvise64_64(int, int, off64_t, off64_t) arm