From c4b44a1475823ccd36b03f4ad96b5a2b64ee7355 Mon Sep 17 00:00:00 2001 From: Maxim Ostapenko Date: Wed, 7 Dec 2016 16:18:51 +0300 Subject: [PATCH] Revert GCC specific changes in LSan code. Change-Id: I52e3cc2f31e3ea1b2d1da9aca6639a94cd56b42a Signed-off-by: Maxim Ostapenko --- lsan/MERGE | 2 + .../sanitizer_platform_limits_posix.h | 66 +--------------------- lsan/src/sanitizer_platform_limits_linux.cc | 3 +- lsan/src/sanitizer_platform_limits_posix.cc | 2 +- lsan/src/sanitizer_stacktrace.cc | 4 +- 5 files changed, 8 insertions(+), 69 deletions(-) create mode 100644 lsan/MERGE diff --git a/lsan/MERGE b/lsan/MERGE new file mode 100644 index 0000000..5f1e8b0 --- /dev/null +++ b/lsan/MERGE @@ -0,0 +1,2 @@ +The code base was taken from LLVM source tree https://reviews.llvm.org/rL253558 +with local modifications for Tizen. diff --git a/lsan/include/sanitizer_common/sanitizer_platform_limits_posix.h b/lsan/include/sanitizer_common/sanitizer_platform_limits_posix.h index fc1fb80..aeea55f 100644 --- a/lsan/include/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/lsan/include/sanitizer_common/sanitizer_platform_limits_posix.h @@ -74,13 +74,6 @@ namespace __sanitizer { #elif defined(__powerpc64__) const unsigned struct_kernel_stat_sz = 144; const unsigned struct_kernel_stat64_sz = 104; -#elif defined(__sparc__) && defined(__arch64__) - const unsigned struct___old_kernel_stat_sz = 0; - const unsigned struct_kernel_stat_sz = 104; - const unsigned struct_kernel_stat64_sz = 144; -#elif defined(__sparc__) && !defined(__arch64__) - const unsigned struct___old_kernel_stat_sz = 0; - const unsigned struct_kernel_stat_sz = 64; #elif defined(__mips__) #if SANITIZER_WORDSIZE == 64 const unsigned struct_kernel_stat_sz = 216; @@ -88,14 +81,6 @@ namespace __sanitizer { const unsigned struct_kernel_stat_sz = 144; #endif const unsigned struct_kernel_stat64_sz = 104; -#elif defined(__sparc__) && defined(__arch64__) - const unsigned struct___old_kernel_stat_sz = 0; - const unsigned struct_kernel_stat_sz = 104; - const unsigned struct_kernel_stat64_sz = 144; -#elif defined(__sparc__) && !defined(__arch64__) - const unsigned struct___old_kernel_stat_sz = 0; - const unsigned struct_kernel_stat_sz = 64; - const unsigned struct_kernel_stat64_sz = 104; #endif struct __sanitizer_perf_event_attr { unsigned type; @@ -118,7 +103,7 @@ namespace __sanitizer { #if defined(__powerpc64__) const unsigned struct___old_kernel_stat_sz = 0; -#elif !defined(__sparc__) +#else const unsigned struct___old_kernel_stat_sz = 32; #endif @@ -209,18 +194,6 @@ namespace __sanitizer { unsigned short __pad1; unsigned long __unused1; unsigned long __unused2; -#elif defined(__sparc__) -# if defined(__arch64__) - unsigned mode; - unsigned short __pad1; -# else - unsigned short __pad1; - unsigned short mode; - unsigned short __pad2; -# endif - unsigned short __seq; - unsigned long long __unused1; - unsigned long long __unused2; #else unsigned short mode; unsigned short __pad1; @@ -238,26 +211,6 @@ namespace __sanitizer { struct __sanitizer_shmid_ds { __sanitizer_ipc_perm shm_perm; - #if defined(__sparc__) - # if !defined(__arch64__) - u32 __pad1; - # endif - long shm_atime; - # if !defined(__arch64__) - u32 __pad2; - # endif - long shm_dtime; - # if !defined(__arch64__) - u32 __pad3; - # endif - long shm_ctime; - uptr shm_segsz; - int shm_cpid; - int shm_lpid; - unsigned long shm_nattch; - unsigned long __glibc_reserved1; - unsigned long __glibc_reserved2; - #else #ifndef __powerpc__ uptr shm_segsz; #elif !defined(__powerpc64__) @@ -295,7 +248,6 @@ namespace __sanitizer { uptr __unused4; uptr __unused5; #endif -#endif }; #elif SANITIZER_FREEBSD struct __sanitizer_ipc_perm { @@ -613,13 +565,9 @@ namespace __sanitizer { #else __sanitizer_sigset_t sa_mask; #ifndef __mips__ -#if defined(__sparc__) - unsigned long sa_flags; -#else int sa_flags; #endif #endif -#endif #if SANITIZER_LINUX void (*sa_restorer)(); #endif @@ -864,7 +812,7 @@ struct __sanitizer_cookie_io_functions_t { #define IOC_NRBITS 8 #define IOC_TYPEBITS 8 -#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) || defined(__sparc__) +#if defined(__powerpc__) || defined(__powerpc64__) || defined(__mips__) #define IOC_SIZEBITS 13 #define IOC_DIRBITS 3 #define IOC_NONE 1U @@ -894,17 +842,7 @@ struct __sanitizer_cookie_io_functions_t { #define IOC_DIR(nr) (((nr) >> IOC_DIRSHIFT) & IOC_DIRMASK) #define IOC_TYPE(nr) (((nr) >> IOC_TYPESHIFT) & IOC_TYPEMASK) #define IOC_NR(nr) (((nr) >> IOC_NRSHIFT) & IOC_NRMASK) - -#if defined(__sparc__) -// In sparc the 14 bits SIZE field overlaps with the -// least significant bit of DIR, so either IOC_READ or -// IOC_WRITE shall be 1 in order to get a non-zero SIZE. -# define IOC_SIZE(nr) \ - ((((((nr) >> 29) & 0x7) & (4U|2U)) == 0)? \ - 0 : (((nr) >> 16) & 0x3fff)) -#else #define IOC_SIZE(nr) (((nr) >> IOC_SIZESHIFT) & IOC_SIZEMASK) -#endif extern unsigned struct_ifreq_sz; extern unsigned struct_termios_sz; diff --git a/lsan/src/sanitizer_platform_limits_linux.cc b/lsan/src/sanitizer_platform_limits_linux.cc index a1f0432..8779d8a 100644 --- a/lsan/src/sanitizer_platform_limits_linux.cc +++ b/lsan/src/sanitizer_platform_limits_linux.cc @@ -36,7 +36,6 @@ #define uid_t __kernel_uid_t #define gid_t __kernel_gid_t #define off_t __kernel_off_t -#define time_t __kernel_time_t // This header seems to contain the definitions of _kernel_ stat* structs. #include #undef ino_t @@ -61,7 +60,7 @@ namespace __sanitizer { } // namespace __sanitizer #if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__aarch64__)\ - && !defined(__mips__) && !defined(__sparc__) + && !defined(__mips__) COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat)); #endif diff --git a/lsan/src/sanitizer_platform_limits_posix.cc b/lsan/src/sanitizer_platform_limits_posix.cc index 0933685..5c482fd 100644 --- a/lsan/src/sanitizer_platform_limits_posix.cc +++ b/lsan/src/sanitizer_platform_limits_posix.cc @@ -1065,7 +1065,7 @@ CHECK_SIZE_AND_OFFSET(__sysctl_args, newlen); CHECK_TYPE_SIZE(__kernel_uid_t); CHECK_TYPE_SIZE(__kernel_gid_t); -#if !defined(__aarch64__) +#if SANITIZER_USES_UID16_SYSCALLS CHECK_TYPE_SIZE(__kernel_old_uid_t); CHECK_TYPE_SIZE(__kernel_old_gid_t); #endif diff --git a/lsan/src/sanitizer_stacktrace.cc b/lsan/src/sanitizer_stacktrace.cc index 796d472..7b0c084 100644 --- a/lsan/src/sanitizer_stacktrace.cc +++ b/lsan/src/sanitizer_stacktrace.cc @@ -60,8 +60,8 @@ static inline uhwptr *GetCanonicFrame(uptr bp, // Nope, this does not look right either. This means the frame after next does // not have a valid frame pointer, but we can still extract the caller PC. // Unfortunately, there is no way to decide between GCC and LLVM frame - // layouts. Assume GCC. - return bp_prev - 1; + // layouts. Assume LLVM. + return bp_prev; #else return (uhwptr*)bp; #endif -- 2.7.4