[compiler-rt] r235799 - [Msan] Fix the iconv.cc test to build and pass on FreeBSD
Viktor Kutuzov
vkutuzov at accesssoftek.com
Sat Apr 25 04:07:05 PDT 2015
Author: vkutuzov
Date: Sat Apr 25 06:07:05 2015
New Revision: 235799
URL: http://llvm.org/viewvc/llvm-project?rev=235799&view=rev
Log:
[Msan] Fix the iconv.cc test to build and pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D9252
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/trunk/test/msan/iconv.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=235799&r1=235798&r2=235799&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Sat Apr 25 06:07:05 2015
@@ -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
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h?rev=235799&r1=235798&r2=235799&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_interceptors.h Sat Apr 25 06:07:05 2015
@@ -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
Modified: compiler-rt/trunk/test/msan/iconv.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/iconv.cc?rev=235799&r1=235798&r2=235799&view=diff
==============================================================================
--- compiler-rt/trunk/test/msan/iconv.cc (original)
+++ compiler-rt/trunk/test/msan/iconv.cc Sat Apr 25 06:07:05 2015
@@ -15,7 +15,12 @@ int main(void) {
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_);
More information about the llvm-commits
mailing list