[PATCH] [Msan] Fix the iconv.cc test to build and pass on FreeBSD
Viktor Kutuzov
vkutuzov at accesssoftek.com
Fri Apr 24 05:38:55 PDT 2015
Hi kcc, samsonov, eugenis, emaste,
http://reviews.llvm.org/D9252
Files:
lib/sanitizer_common/sanitizer_common_interceptors.inc
lib/sanitizer_common/sanitizer_platform_interceptors.h
test/msan/iconv.cc
Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -47,6 +47,7 @@
#define pthread_setname_np pthread_set_name_np
#define inet_aton __inet_aton
#define inet_pton __inet_pton
+#define iconv __bsd_iconv
#endif
#ifndef COMMON_INTERCEPTOR_INITIALIZE_RANGE
Index: lib/sanitizer_common/sanitizer_platform_interceptors.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -204,7 +204,7 @@
#define SANITIZER_INTERCEPT_LGAMMAL_R SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_DRAND48_R SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_RAND_R SI_MAC || SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_ICONV SI_LINUX_NOT_ANDROID
+#define SANITIZER_INTERCEPT_ICONV SI_FREEBSD || SI_LINUX_NOT_ANDROID
#define SANITIZER_INTERCEPT_TIMES SI_NOT_WINDOWS
// FIXME: getline seems to be available on OSX 10.7
Index: test/msan/iconv.cc
===================================================================
--- test/msan/iconv.cc
+++ test/msan/iconv.cc
@@ -15,7 +15,12 @@
char inbuf_[100];
strcpy(inbuf_, "sample text");
char outbuf_[100];
+#if defined(__FreeBSD__)
+ // FreeBSD's iconv() expects the 2nd argument be of type 'const char**'.
+ const char *inbuf = inbuf_;
+#else
char *inbuf = inbuf_;
+#endif
char *outbuf = outbuf_;
size_t inbytesleft = strlen(inbuf_);
size_t outbytesleft = sizeof(outbuf_);
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9252.24383.patch
Type: text/x-patch
Size: 1662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150424/6da001bb/attachment.bin>
More information about the llvm-commits
mailing list