Message ID | 5370E664.3040101@partner.samsung.com |
---|---|
State | New |
Headers | show |
Thanks! May I ask you to contribute the patch upstream? https://code.google.com/p/address-sanitizer/wiki/HowToContribute On Mon, May 12, 2014 at 7:19 PM, Maxim Ostapenko <m.ostapenko@partner.samsung.com> wrote: > Hi, > > I see a couple of errors when building for arm-linux-gnueabi (host is x86_64 > Ubuntu 12.04 LTS, host compiler is gcc version 4.6.3 (Ubuntu/Linaro > 4.6.3-1ubuntu5)): > > 1) In file included from > /home/max/workspace/downloads/gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:164:0: > /home/max/workspace/downloads/gcc/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:253:72: > error: size of array 'assertion_failed__1128' is negative > typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1] > ^ > /home/max/workspace/downloads/gcc/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:247:30: > note: in expansion of macro 'IMPL_COMPILER_ASSERT' > #define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__) > ^ > /home/max/workspace/downloads/gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1249:3: > note: in expansion of macro 'COMPILER_CHECK' > COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE)) > ^ > /home/max/workspace/downloads/gcc/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:1128:1: > note: in expansion of macro 'CHECK_TYPE_SIZE' > CHECK_TYPE_SIZE(XDR::xdr_ops); > ^ > make[4]: *** [sanitizer_platform_limits_posix.lo] Error 1 > > > 2) > /home/max/workspace/downloads/gcc/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h:54:77: > error: cast from type 'const volatile Type* {aka const volatile unsigned > char*}' to type 'volatile Type* {aka volatile unsigned char*}' casts away > qualifiers [-Werror=cast-qual] > v = __sync_fetch_and_add((typename T::Type volatile*)&a->val_dont_use, > 0); > > Attached patch seems to help. > > -Maxim
On 05/12/2014 08:16 PM, Konstantin Serebryany wrote: > Thanks! May I ask you to contribute the patch upstream? > https://code.google.com/p/address-sanitizer/wiki/HowToContribute Note that we wouldn't be able to repro in upstream because * ARM isn't supported * LLVM won't build with gcc 4.6 anyway -Y
> * ARM isn't supported
I meant ARM-Linux.
-Y
diff --git a/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h b/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h index 75aa2c8..f2f05a8 100644 --- a/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h +++ b/libsanitizer/sanitizer_common/sanitizer_atomic_clang_other.h @@ -51,7 +51,7 @@ 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; } diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index 97fda51..3ee8e33 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -273,10 +273,17 @@ namespace __sanitizer { #endif #if SANITIZER_LINUX && !SANITIZER_ANDROID + +#if defined(__arm__) + const unsigned struct_xdr_ops_num_funs = 9; +#else + const unsigned struct_xdr_ops_num_funs = 10; +#endif + struct __sanitizer_XDR { int x_op; struct xdr_ops { - uptr fns[10]; + uptr fns[struct_xdr_ops_num_funs]; } *x_ops; uptr x_public; uptr x_private;