[compiler-rt] r208673 - [sanitizer] fix for ARM Linux, patch by Maxim Ostapenko

Greg Fitzgerald garious at gmail.com
Wed May 14 15:40:19 PDT 2014


Hi Kostya,

This broke my ARM Linux build.  I'm using GCC 4.8.2 from Linaro.  It
triggers a compile-time assertion (see below).  Can you please revert?
 Thanks, Greg

lib/sanitizer_common/sanitizer_internal_defs.h:259:72: error: size of
array 'assertion_failed__1130' is negative
     typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                                        ^
lib/sanitizer_common/sanitizer_internal_defs.h:253:30: note: in
expansion of macro 'IMPL_COMPILER_ASSERT'
 #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
                              ^
lib/sanitizer_common/sanitizer_platform_limits_posix.h:1268:3: note:
in expansion of macro 'COMPILER_CHECK'
   COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
   ^
lib/sanitizer_common/sanitizer_platform_limits_posix.cc:1130:1: note:
in expansion of macro 'CHECK_TYPE_SIZE'
 CHECK_TYPE_SIZE(XDR::xdr_ops);





On Tue, May 13, 2014 at 1:01 AM, Kostya Serebryany <kcc at google.com> wrote:
> Author: kcc
> Date: Tue May 13 03:01:59 2014
> New Revision: 208673
>
> URL: http://llvm.org/viewvc/llvm-project?rev=208673&view=rev
> Log:
> [sanitizer] fix for ARM Linux, patch by Maxim Ostapenko
>
> Modified:
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_clang_other.h
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_clang_other.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_clang_other.h?rev=208673&r1=208672&r2=208673&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_clang_other.h (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_clang_other.h Tue May 13 03:01:59 2014
> @@ -53,7 +53,8 @@ INLINE typename T::Type atomic_load(
>      // 64-bit load on 32-bit platform.
>      // Gross, but simple and reliable.
>      // Assume that it is not in read-only memory.
> -    v = __sync_fetch_and_add((typename T::Type volatile*)&a->val_dont_use, 0);
> +    v = __sync_fetch_and_add(
> +        const_cast<typename T::Type volatile *>(&a->val_dont_use), 0);
>    }
>    return v;
>  }
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=208673&r1=208672&r2=208673&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h Tue May 13 03:01:59 2014
> @@ -275,10 +275,17 @@ namespace __sanitizer {
>  #endif
>
>  #if SANITIZER_LINUX && !SANITIZER_ANDROID
> +
> +#if defined(__arm__)
> +  const unsigned kXDROpsNumFuns = 9;
> +#else
> +  const unsigned kXDROpsNumFuns = 10;
> +#endif
> +
>    struct __sanitizer_XDR {
>      int x_op;
>      struct xdr_ops {
> -      uptr fns[10];
> +      uptr fns[kXDROpsNumFuns];
>      } *x_ops;
>      uptr x_public;
>      uptr x_private;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list