diff options
| author | Kamil Rytarowski <n54@gmx.com> | 2017-08-04 22:23:52 +0000 | 
|---|---|---|
| committer | Kamil Rytarowski <n54@gmx.com> | 2017-08-04 22:23:52 +0000 | 
| commit | 6c68c2e2c5d41eb505fd57884596662502634d3e (patch) | |
| tree | e38a14a6393e42013e452c5fde6fd1a552ff1575 /compiler-rt | |
| parent | e6cde144164255e16640960fb7aaf67a183f8098 (diff) | |
| download | bcm5719-llvm-6c68c2e2c5d41eb505fd57884596662502634d3e.tar.gz bcm5719-llvm-6c68c2e2c5d41eb505fd57884596662502634d3e.zip  | |
Add NetBSD support in sanitizer_syscall_generic.inc
Summary:
This adds:
 - NetBSD specific aliases for renamed syscalls,
 - differentiate internal_syscall, internal_syscall64, internal_syscall_ptr as there are various types of syscalls on NetBSD.
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, kcc, vitalybuka, filcab
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36316
llvm-svn: 310139
Diffstat (limited to 'compiler-rt')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc | 30 | 
1 files changed, 27 insertions, 3 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc b/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc index 15cf05f0608..b1a5941a505 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc @@ -7,17 +7,41 @@  //  //===----------------------------------------------------------------------===//  // -// Generic implementations of internal_syscall and internal_iserror. +// Generic implementations of internal_syscall* and internal_iserror.  //  //===----------------------------------------------------------------------===// -#if SANITIZER_FREEBSD || SANITIZER_MAC +#if SANITIZER_FREEBSD || SANITIZER_MAC || SANITIZER_NETBSD  # define SYSCALL(name) SYS_ ## name  #else  # define SYSCALL(name) __NR_ ## name  #endif -#if (SANITIZER_FREEBSD || SANITIZER_MAC) && defined(__x86_64__) +#if SANITIZER_NETBSD +// We use 3 kinds of internal_syscall's for different types of retval in order +// to address differences in calling conventions (e.g. registers to place the +// return value in). +//   - internal_syscall     for 32-bit length (int, pid_t) +//   - internal_syscall64   for 64-bit length (off_t) +//   - internal_syscall_ptr for pointer and (s)size_t +# define  internal_syscall      syscall +# define  internal_syscall64    __syscall +// Handle syscall renames manually +# define SYS_stat SYS___stat50 +# define SYS_lstat SYS___lstat50 +# define SYS_fstat SYS___fstat50 +# define SYS_gettimeofday SYS___gettimeofday50 +# define SYS_wait4 SYS___wait450 +# define SYS_getdents SYS___getdents30 +# define SYS_sigaltstack SYS___sigaltstack14 +# define SYS_sigprocmask SYS___sigprocmask14 +# define SYS_nanosleep SYS___nanosleep50 +# if SANITIZER_WORDSIZE == 64 +#  define internal_syscall_ptr  __syscall +# else +#  define internal_syscall_ptr  syscall +# endif +#elif defined(__x86_64__) && (SANITIZER_FREEBSD || SANITIZER_MAC)  # define internal_syscall __syscall  # else  # define internal_syscall syscall  | 

