diff options
author | Vitaly Buka <vitalybuka@google.com> | 2018-06-17 17:58:08 +0000 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2018-06-17 17:58:08 +0000 |
commit | 02b1a0bb609f7b3b6d265c3bb17269f32aa1bbe1 (patch) | |
tree | 4cdbe5251931eab50aab71a0a21f1eb6be9d5858 | |
parent | 2512985e8af44d1a05b8e46183352554aa3a2326 (diff) |
[sanitizer] Fix tsan GO build
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@334914 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/sanitizer_common/sanitizer_linux_libcdep.cc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc index 70599b0a9..6a6a3413a 100644 --- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc @@ -157,6 +157,26 @@ bool SetEnv(const char *name, const char *value) { } #endif +static bool GetLibcVersion(int *major, int *minor, int *patch) { +#ifdef _CS_GNU_LIBC_VERSION + char buf[64]; + uptr len = confstr(_CS_GNU_LIBC_VERSION, buf, sizeof(buf)); + if (len >= sizeof(buf)) + return false; + buf[len] = 0; + static const char kGLibC[] = "glibc "; + if (internal_strncmp(buf, kGLibC, sizeof(kGLibC) - 1) != 0) + return false; + const char *p = buf + sizeof(kGLibC) - 1; + *major = internal_simple_strtoll(p, &p, 10); + *minor = (*p == '.') ? internal_simple_strtoll(p + 1, &p, 10) : 0; + *patch = (*p == '.') ? internal_simple_strtoll(p + 1, &p, 10) : 0; + return true; +#else + return false; +#endif +} + #if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && \ !SANITIZER_NETBSD && !SANITIZER_OPENBSD && !SANITIZER_SOLARIS static uptr g_tls_size; @@ -194,26 +214,6 @@ void CallGetTls(void* ptr, size_t* size, size_t* align) { get_tls(size, align); } -bool GetLibcVersion(int *major, int *minor, int *patch) { -#ifdef _CS_GNU_LIBC_VERSION - char buf[64]; - uptr len = confstr(_CS_GNU_LIBC_VERSION, buf, sizeof(buf)); - if (len >= sizeof(buf)) - return false; - buf[len] = 0; - static const char kGLibC[] = "glibc "; - if (internal_strncmp(buf, kGLibC, sizeof(kGLibC) - 1) != 0) - return false; - const char *p = buf + sizeof(kGLibC) - 1; - *major = internal_simple_strtoll(p, &p, 10); - *minor = (*p == '.') ? internal_simple_strtoll(p + 1, &p, 10) : 0; - *patch = (*p == '.') ? internal_simple_strtoll(p + 1, &p, 10) : 0; - return true; -#else - return false; -#endif -} - bool CmpLibcVersion(int major, int minor, int patch) { int ma; int mi; |