[compiler-rt] r348888 - [Sanitizer] Expand FSEEK interception to FreeBSD
David Carlier via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 11 11:08:40 PST 2018
Author: devnexen
Date: Tue Dec 11 11:08:40 2018
New Revision: 348888
URL: http://llvm.org/viewvc/llvm-project?rev=348888&view=rev
Log:
[Sanitizer] Expand FSEEK interception to FreeBSD
Reviewers: krytarowski
Reviewed By: krytarowski
Differential Revision: https://reviews.llvm.org/D55556
Added:
compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fseek.cc
- copied, changed from r348887, compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc
Removed:
compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=348888&r1=348887&r2=348888&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Tue Dec 11 11:08:40 2018
@@ -539,7 +539,7 @@
#define SANITIZER_INTERCEPT_MD4 SI_NETBSD
#define SANITIZER_INTERCEPT_RMD160 SI_NETBSD
#define SANITIZER_INTERCEPT_MD5 SI_NETBSD
-#define SANITIZER_INTERCEPT_FSEEK SI_NETBSD
+#define SANITIZER_INTERCEPT_FSEEK (SI_NETBSD || SI_FREEBSD)
#define SANITIZER_INTERCEPT_MD2 SI_NETBSD
#define SANITIZER_INTERCEPT_SHA2 SI_NETBSD
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc?rev=348888&r1=348887&r2=348888&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc Tue Dec 11 11:08:40 2018
@@ -104,6 +104,7 @@ namespace __sanitizer {
unsigned timeval_sz = sizeof(timeval);
unsigned uid_t_sz = sizeof(uid_t);
unsigned gid_t_sz = sizeof(gid_t);
+ unsigned fpos_t_sz = sizeof(fpos_t);
unsigned mbstate_t_sz = sizeof(mbstate_t);
unsigned sigset_t_sz = sizeof(sigset_t);
unsigned struct_timezone_sz = sizeof(struct timezone);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h?rev=348888&r1=348887&r2=348888&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h Tue Dec 11 11:08:40 2018
@@ -48,6 +48,7 @@ namespace __sanitizer {
extern unsigned timeval_sz;
extern unsigned uid_t_sz;
extern unsigned gid_t_sz;
+ extern unsigned fpos_t_sz;
extern unsigned mbstate_t_sz;
extern unsigned struct_timezone_sz;
extern unsigned struct_tms_sz;
Removed: compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc?rev=348887&view=auto
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc (removed)
@@ -1,51 +0,0 @@
-// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
-
-#include <assert.h>
-#include <inttypes.h>
-#include <stdio.h>
-
-int main(void) {
- printf("fseek\n");
-
- FILE *fp = fopen("/etc/fstab", "r");
- assert(fp);
-
- int rv = fseek(fp, 10, SEEK_SET);
- assert(!rv);
-
- printf("position: %ld\n", ftell(fp));
-
- rewind(fp);
-
- printf("position: %ld\n", ftell(fp));
-
- rv = fseeko(fp, 15, SEEK_SET);
- assert(!rv);
-
- printf("position: %" PRIuMAX "\n", (uintmax_t)ftello(fp));
-
- fpos_t pos;
- rv = fgetpos(fp, &pos);
- assert(!rv);
-
- rewind(fp);
-
- printf("position: %" PRIuMAX "\n", (uintmax_t)ftello(fp));
-
- rv = fsetpos(fp, &pos);
- assert(!rv);
-
- printf("position: %" PRIuMAX "\n", (uintmax_t)ftello(fp));
-
- rv = fclose(fp);
- assert(!rv);
-
- // CHECK: fseek
- // CHECK: position: 10
- // CHECK: position: 0
- // CHECK: position: 15
- // CHECK: position: 0
- // CHECK: position: 15
-
- return 0;
-}
Copied: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fseek.cc (from r348887, compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fseek.cc?p2=compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fseek.cc&p1=compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc&r1=348887&r2=348888&rev=348888&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/NetBSD/fseek.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/fseek.cc Tue Dec 11 11:08:40 2018
@@ -1,4 +1,6 @@
// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
+//
+// UNSUPPORTED: linux, darwin, solaris
#include <assert.h>
#include <inttypes.h>
More information about the llvm-commits
mailing list