|
| 1 | +--- src/librustc_metadata/creader.rs.orig 2017-12-07 00:07:53.000000000 +0300 |
| 2 | ++++ src/librustc_metadata/creader.rs 2018-01-11 01:15:56.811552000 +0300 |
| 3 | +@@ -750,10 +750,13 @@ |
| 4 | + // Sanitizers can only be used on some tested platforms with |
| 5 | + // executables linked to `std` |
| 6 | + const ASAN_SUPPORTED_TARGETS: &[&str] = &["x86_64-unknown-linux-gnu", |
| 7 | +- "x86_64-apple-darwin"]; |
| 8 | ++ "x86_64-apple-darwin", |
| 9 | ++ "x86_64-unknown-freebsd"]; |
| 10 | + const TSAN_SUPPORTED_TARGETS: &[&str] = &["x86_64-unknown-linux-gnu", |
| 11 | +- "x86_64-apple-darwin"]; |
| 12 | +- const LSAN_SUPPORTED_TARGETS: &[&str] = &["x86_64-unknown-linux-gnu"]; |
| 13 | ++ "x86_64-apple-darwin", |
| 14 | ++ "x86_64-unknown-freebsd"]; |
| 15 | ++ const LSAN_SUPPORTED_TARGETS: &[&str] = &["x86_64-unknown-linux-gnu", |
| 16 | ++ "x86_64-unknown-freebsd"]; |
| 17 | + const MSAN_SUPPORTED_TARGETS: &[&str] = &["x86_64-unknown-linux-gnu"]; |
| 18 | + |
| 19 | + let supported_targets = match *sanitizer { |
| 20 | +--- src/libstd/Cargo.toml.orig 2017-12-07 00:07:53.000000000 +0300 |
| 21 | ++++ src/libstd/Cargo.toml 2018-01-11 01:15:34.702391000 +0300 |
| 22 | +@@ -38,6 +38,11 @@ |
| 23 | + rustc_msan = { path = "../librustc_msan" } |
| 24 | + rustc_tsan = { path = "../librustc_tsan" } |
| 25 | + |
| 26 | ++[target.x86_64-unknown-freebsd.dependencies] |
| 27 | ++rustc_asan = { path = "../librustc_asan" } |
| 28 | ++rustc_lsan = { path = "../librustc_lsan" } |
| 29 | ++rustc_tsan = { path = "../librustc_tsan" } |
| 30 | ++ |
| 31 | + [build-dependencies] |
| 32 | + build_helper = { path = "../build_helper" } |
| 33 | +--- src/build_helper/lib.rs.orig 2018-01-10 18:11:28.301850000 +0300 |
| 34 | ++++ src/build_helper/lib.rs 2018-01-10 18:10:28.258518000 +0300 |
| 35 | +@@ -256,6 +256,10 @@ |
| 36 | + format!("clang_rt.{}-x86_64", sanitizer_name), |
| 37 | + "build/lib/linux", |
| 38 | + ), |
| 39 | ++ "x86_64-unknown-freebsd" => ( |
| 40 | ++ format!("clang_rt.{}-x86_64", sanitizer_name), |
| 41 | ++ "build/lib/freebsd", |
| 42 | ++ ), |
| 43 | + "x86_64-apple-darwin" => ( |
| 44 | + format!("dylib=clang_rt.{}_osx_dynamic", sanitizer_name), |
| 45 | + "build/lib/darwin", |
| 46 | +--- src/libcompiler_builtins/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc |
| 47 | ++++ src/libcompiler_builtins/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc |
| 48 | +@@ -223,7 +223,8 @@ static void kernel_stat_to_stat(struct kernel_stat *in, struct stat *out) { |
| 49 | + |
| 50 | + uptr internal_stat(const char *path, void *buf) { |
| 51 | + #if SANITIZER_FREEBSD |
| 52 | +- return internal_syscall(SYSCALL(stat), path, buf); |
| 53 | ++ return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, |
| 54 | ++ (uptr)buf, 0); |
| 55 | + #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
| 56 | + return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, |
| 57 | + (uptr)buf, 0); |
| 58 | +@@ -247,7 +248,8 @@ uptr internal_stat(const char *path, void *buf) { |
| 59 | + |
| 60 | + uptr internal_lstat(const char *path, void *buf) { |
| 61 | + #if SANITIZER_FREEBSD |
| 62 | +- return internal_syscall(SYSCALL(lstat), path, buf); |
| 63 | ++ return internal_syscall(SYSCALL(fstatat), AT_FDCWD, (uptr)path, |
| 64 | ++ (uptr)buf, AT_SYMLINK_NOFOLLOW); |
| 65 | + #elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
| 66 | + return internal_syscall(SYSCALL(newfstatat), AT_FDCWD, (uptr)path, |
| 67 | + (uptr)buf, AT_SYMLINK_NOFOLLOW); |
| 68 | +@@ -590,7 +592,9 @@ uptr internal_getppid() { |
| 69 | + } |
| 70 | + |
| 71 | + uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) { |
| 72 | +-#if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
| 73 | ++#if SANITIZER_FREEBSD |
| 74 | ++ return internal_syscall(SYSCALL(getdirentries), fd, (uptr)dirp, count, NULL); |
| 75 | ++#elif SANITIZER_USES_CANONICAL_LINUX_SYSCALLS |
| 76 | + return internal_syscall(SYSCALL(getdents64), fd, (uptr)dirp, count); |
| 77 | + #else |
| 78 | + return internal_syscall(SYSCALL(getdents), fd, (uptr)dirp, count); |
| 79 | +--- src/libcompiler_builtins/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h.orig 2017-05-24 19:09:24.000000000 +0000 |
| 80 | ++++ src/libcompiler_builtins/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h 2017-05-24 20:12:47.183536000 +0000 |
| 81 | +@@ -485,7 +485,12 @@ |
| 82 | + }; |
| 83 | + #elif SANITIZER_FREEBSD |
| 84 | + struct __sanitizer_dirent { |
| 85 | ++#if __FreeBSD_version < 1200031 |
| 86 | + unsigned int d_fileno; |
| 87 | ++#else |
| 88 | ++ unsigned long long d_fileno; |
| 89 | ++ unsigned long long d_off; |
| 90 | ++#endif |
| 91 | + unsigned short d_reclen; |
| 92 | + // more fields that we don't care about |
| 93 | + }; |
0 commit comments