From f9c22916d56ed9ca209032d32ebd081fbf097eb4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 20 Jun 2014 22:49:41 +0000 Subject: [PATCH] tsan: fix freebsd build freebsd does not have /proc/self/environ llvm-svn: 211417 --- compiler-rt/lib/sanitizer_common/sanitizer_linux.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc index 5f7d70c..7bb98a9 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc @@ -48,6 +48,7 @@ #include #if SANITIZER_FREEBSD +#include // for getenv #include #include extern "C" { @@ -314,6 +315,7 @@ u64 NanoTime() { return (u64)tv.tv_sec * 1000*1000*1000 + tv.tv_usec * 1000; } +#if SANITIZER_LINUX // Like getenv, but reads env directly from /proc and does not use libc. // This function should be called first inside __asan_init. const char *GetEnv(const char *name) { @@ -341,6 +343,11 @@ const char *GetEnv(const char *name) { } return 0; // Not found. } +#else +const char *GetEnv(const char *name) { + return getenv(name); +} +#endif extern "C" { SANITIZER_WEAK_ATTRIBUTE extern void *__libc_stack_end; -- 2.7.4