Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/libsanitizer/sanitizer_common Quick h...



details:   https://anonhg.NetBSD.org/src/rev/efab64452b99
branches:  trunk
changeset: 362339:efab64452b99
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jun 04 13:12:54 2018 +0000

description:
Quick hack to fix 32bit big endian platforms: the return value from
__syscall() needs to be shifted into the lower 32bits to form a proper
pointer. Temporarily steal __SYSCALL_TO_UINTPTR_T from the syscall/__syscall
test program, Kamil is working on a proper solution.

diffstat:

 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc |  12 ++++++++-
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 51afec93f887 -r efab64452b99 external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc
--- a/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Mon Jun 04 09:57:19 2018 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/sanitizer_common/sanitizer_linux.cc   Mon Jun 04 13:12:54 2018 +0000
@@ -113,8 +113,16 @@
 uptr internal_mmap(void *addr, uptr length, int prot, int flags, int fd,
                    OFF_T offset) {
 #if SANITIZER_NETBSD
-  return internal_syscall64(SYSCALL(mmap), addr, length, prot, flags, fd,
-                             (long)0, offset);
+
+#if !defined(_LP64) && BYTE_ORDER == _BIG_ENDIAN
+#define __SYSCALL_TO_UINTPTR_T(V)       ((uintptr_t)((V)>>32))
+#else
+#define __SYSCALL_TO_UINTPTR_T(V)       ((uintptr_t)(V))
+#endif
+
+  return __SYSCALL_TO_UINTPTR_T(
+           internal_syscall64(SYSCALL(mmap), addr, length, prot, flags, fd,
+                             (long)0, offset));
 #elif SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS
   return internal_syscall(SYSCALL(mmap), (uptr)addr, length, prot, flags, fd,
                           offset, 0);



Home | Main Index | Thread Index | Old Index