[PATCH] D37244: Finalize ASAN/NetBSD

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 18:46:04 PDT 2017


krytarowski created this revision.
krytarowski added a project: Sanitizers.
Herald added subscribers: mgorny, kubamracek, srhines.

This revision contains various cleanups.

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D37244

Files:
  lib/asan/scripts/asan_symbolize.py
  lib/sanitizer_common/sanitizer_internal_defs.h
  test/asan/TestCases/alloca_constant_size.cc
  test/asan/TestCases/atexit_stats.cc
  test/asan/TestCases/non-executable-pc.cpp
  test/asan/TestCases/verbose-log-path_test.cc
  test/sanitizer_common/CMakeLists.txt


Index: test/sanitizer_common/CMakeLists.txt
===================================================================
--- test/sanitizer_common/CMakeLists.txt
+++ test/sanitizer_common/CMakeLists.txt
@@ -4,7 +4,7 @@
 set(SANITIZER_COMMON_TESTSUITES)
 
 set(SUPPORTED_TOOLS)
-if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD" AND NOT ANDROID)
+if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux|FreeBSD|NetBSD" AND NOT ANDROID)
   list(APPEND SUPPORTED_TOOLS asan)
 endif()
 if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT ANDROID)
Index: test/asan/TestCases/verbose-log-path_test.cc
===================================================================
--- test/asan/TestCases/verbose-log-path_test.cc
+++ test/asan/TestCases/verbose-log-path_test.cc
@@ -8,7 +8,7 @@
 // RUN: %env_asan_opts=log_path=%T/asan.log:log_exe_name=1 not %run %T/verbose-log-path_test-binary 2> %t.out
 // RUN: FileCheck %s --check-prefix=CHECK-ERROR < %T/asan.log.verbose-log-path_test-binary.*
 
-// FIXME: only FreeBSD and Linux have verbose log paths now.
+// FIXME: only FreeBSD, NetBSD and Linux have verbose log paths now.
 // XFAIL: win32,android
 // UNSUPPORTED: ios
 
Index: test/asan/TestCases/non-executable-pc.cpp
===================================================================
--- test/asan/TestCases/non-executable-pc.cpp
+++ test/asan/TestCases/non-executable-pc.cpp
@@ -2,8 +2,8 @@
 // RUN: not %run %t 0 2>&1 | FileCheck %s
 // RUN: not %run %t n 2>&1 | FileCheck %s -check-prefix=CHECK -check-prefix=NON_EXEC
 
-// Only Linux and FreeBSD list every memory region in MemoryMappingLayout, for now.
-// REQUIRES: linux || freebsd
+// Not every OS lists every memory region in MemoryMappingLayout.
+// REQUIRES: linux || freebsd || netbsd
 
 #include <assert.h>
 
Index: test/asan/TestCases/atexit_stats.cc
===================================================================
--- test/asan/TestCases/atexit_stats.cc
+++ test/asan/TestCases/atexit_stats.cc
@@ -7,7 +7,7 @@
 // UNSUPPORTED: android
 
 #include <stdlib.h>
-#if !defined(__APPLE__) && !defined(__FreeBSD__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
 #include <malloc.h>
 #endif
 int *p1 = (int*)malloc(900);
Index: test/asan/TestCases/alloca_constant_size.cc
===================================================================
--- test/asan/TestCases/alloca_constant_size.cc
+++ test/asan/TestCases/alloca_constant_size.cc
@@ -10,7 +10,7 @@
 // MSVC provides _alloca instead of alloca.
 #if defined(_MSC_VER) && !defined(alloca)
 # define alloca _alloca
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
 #include <stdlib.h>
 #else
 #include <alloca.h>
Index: lib/sanitizer_common/sanitizer_internal_defs.h
===================================================================
--- lib/sanitizer_common/sanitizer_internal_defs.h
+++ lib/sanitizer_common/sanitizer_internal_defs.h
@@ -129,10 +129,6 @@
 #endif
 typedef int pid_t;
 
-// WARNING: OFF_T may be different from OS type off_t, depending on the value of
-// _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system calls
-// like pread and mmap, as opposed to pread64 and mmap64.
-// FreeBSD, NetBSD, Mac and Linux/x86-64 are special.
 #if SANITIZER_FREEBSD || SANITIZER_NETBSD || SANITIZER_MAC || \
     (SANITIZER_LINUX && defined(__x86_64__))
 typedef u64 OFF_T;
Index: lib/asan/scripts/asan_symbolize.py
===================================================================
--- lib/asan/scripts/asan_symbolize.py
+++ lib/asan/scripts/asan_symbolize.py
@@ -280,7 +280,7 @@
 def SystemSymbolizerFactory(system, addr, binary, arch):
   if system == 'Darwin':
     return DarwinSymbolizer(addr, binary, arch)
-  elif system == 'Linux' or system == 'FreeBSD' or system == 'NetBSD':
+  elif system in ['Linux', 'FreeBSD', 'NetBSD']:
     return Addr2LineSymbolizer(binary)
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37244.113008.patch
Type: text/x-patch
Size: 3843 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170829/7f92a936/attachment.bin>


More information about the llvm-commits mailing list