[PATCH] libsanitizer merge from upstream r208536 fix for ARM Linux.
Maxim Ostapenko
m.ostapenko at partner.samsung.com
Tue May 13 00:37:30 PDT 2014
Hi kcc,
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
http://reviews.llvm.org/D3737
Files:
sanitizer_common/sanitizer_atomic_clang_other.h
sanitizer_common/sanitizer_platform_limits_posix.h
Index: sanitizer_common/sanitizer_atomic_clang_other.h
===================================================================
--- sanitizer_common/sanitizer_atomic_clang_other.h
+++ sanitizer_common/sanitizer_atomic_clang_other.h
@@ -53,7 +53,7 @@
// 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;
}
Index: sanitizer_common/sanitizer_platform_limits_posix.h
===================================================================
--- sanitizer_common/sanitizer_platform_limits_posix.h
+++ sanitizer_common/sanitizer_platform_limits_posix.h
@@ -275,10 +275,17 @@
#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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3737.9336.patch
Type: text/x-patch
Size: 1200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140513/4a4dcac2/attachment.bin>
More information about the llvm-commits
mailing list