[compiler-rt] r263218 - [Sanitizer][MIPS] internal lstat and fstat for mips64
Mohit K. Bhakkad via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 02:51:05 PST 2016
Author: mohit.bhakkad
Date: Fri Mar 11 04:51:03 2016
New Revision: 263218
URL: http://llvm.org/viewvc/llvm-project?rev=263218&view=rev
Log:
[Sanitizer][MIPS] internal lstat and fstat for mips64
Reviewers: dvyukov
Subscribers: jaydeep, sagar, llvm-commits
Differential Revision: http://reviews.llvm.org/D18078
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=263218&r1=263217&r2=263218&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Fri Mar 11 04:51:03 2016
@@ -244,7 +244,15 @@ uptr internal_lstat(const char *path, vo
return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path,
(uptr)buf, AT_SYMLINK_NOFOLLOW);
#elif SANITIZER_LINUX_USES_64BIT_SYSCALLS
+# if SANITIZER_MIPS64
+ // For mips64, lstat syscall fills buffer in the format of kernel_stat
+ struct kernel_stat kbuf;
+ int res = internal_syscall(SYSCALL(lstat), path, &kbuf);
+ kernel_stat_to_stat(&kbuf, (struct stat *)buf);
+ return res;
+# else
return internal_syscall(SYSCALL(lstat), (uptr)path, (uptr)buf);
+# endif
#else
struct stat64 buf64;
int res = internal_syscall(SYSCALL(lstat64), path, &buf64);
@@ -255,7 +263,15 @@ uptr internal_lstat(const char *path, vo
uptr internal_fstat(fd_t fd, void *buf) {
#if SANITIZER_FREEBSD || SANITIZER_LINUX_USES_64BIT_SYSCALLS
+# if SANITIZER_MIPS64
+ // For mips64, fstat syscall fills buffer in the format of kernel_stat
+ struct kernel_stat kbuf;
+ int res = internal_syscall(SYSCALL(fstat), fd, &kbuf);
+ kernel_stat_to_stat(&kbuf, (struct stat *)buf);
+ return res;
+# else
return internal_syscall(SYSCALL(fstat), fd, (uptr)buf);
+# endif
#else
struct stat64 buf64;
int res = internal_syscall(SYSCALL(fstat64), fd, &buf64);
More information about the llvm-commits
mailing list