[compiler-rt] r373632 - compiler-rt: move all __GLIBC_PREREQ into own header file
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 3 10:46:08 PDT 2019
Author: vitalybuka
Date: Thu Oct 3 10:46:07 2019
New Revision: 373632
URL: http://llvm.org/viewvc/llvm-project?rev=373632&view=rev
Log:
compiler-rt: move all __GLIBC_PREREQ into own header file
Reviewers: eugenis
Subscribers: dberris, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D68177
Added:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_glibc_version.h
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_getauxval.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_getauxval.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_getauxval.h?rev=373632&r1=373631&r2=373632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_getauxval.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_getauxval.h Thu Oct 3 10:46:07 2019
@@ -17,15 +17,10 @@
#define SANITIZER_GETAUXVAL_H
#include "sanitizer_platform.h"
+#include "sanitizer_glibc_version.h"
#if SANITIZER_LINUX || SANITIZER_FUCHSIA
-# include <features.h>
-
-# ifndef __GLIBC_PREREQ
-# define __GLIBC_PREREQ(x, y) 0
-# endif
-
# if __GLIBC_PREREQ(2, 16) || (SANITIZER_ANDROID && __ANDROID_API__ >= 21) || \
SANITIZER_FUCHSIA
# define SANITIZER_USE_GETAUXVAL 1
Added: compiler-rt/trunk/lib/sanitizer_common/sanitizer_glibc_version.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_glibc_version.h?rev=373632&view=auto
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_glibc_version.h (added)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_glibc_version.h Thu Oct 3 10:46:07 2019
@@ -0,0 +1,26 @@
+//===-- sanitizer_glibc_version.h -----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of Sanitizer common code.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SANITIZER_GLIBC_VERSION_H
+#define SANITIZER_GLIBC_VERSION_H
+
+#include "sanitizer_platform.h"
+
+#if SANITIZER_LINUX || SANITIZER_FUCHSIA
+#include <features.h>
+#endif
+
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
+#endif
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cpp?rev=373632&r1=373631&r2=373632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cpp (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cpp Thu Oct 3 10:46:07 2019
@@ -23,6 +23,7 @@
#include "sanitizer_flags.h"
#include "sanitizer_freebsd.h"
#include "sanitizer_getauxval.h"
+#include "sanitizer_glibc_version.h"
#include "sanitizer_linux.h"
#include "sanitizer_placement_new.h"
#include "sanitizer_procmaps.h"
@@ -188,11 +189,7 @@ __attribute__((unused)) static bool GetL
static uptr g_tls_size;
#ifdef __i386__
-# ifndef __GLIBC_PREREQ
-# define CHECK_GET_TLS_STATIC_INFO_VERSION 1
-# else
-# define CHECK_GET_TLS_STATIC_INFO_VERSION (!__GLIBC_PREREQ(2, 27))
-# endif
+# define CHECK_GET_TLS_STATIC_INFO_VERSION (!__GLIBC_PREREQ(2, 27))
#else
# define CHECK_GET_TLS_STATIC_INFO_VERSION 0
#endif
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp?rev=373632&r1=373631&r2=373632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp Thu Oct 3 10:46:07 2019
@@ -22,6 +22,10 @@
#ifdef _FILE_OFFSET_BITS
#undef _FILE_OFFSET_BITS
#endif
+
+// Must go after undef _FILE_OFFSET_BITS.
+#include "sanitizer_glibc_version.h"
+
#include <arpa/inet.h>
#include <dirent.h>
#include <grp.h>
@@ -1005,10 +1009,6 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len)
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
-#ifndef __GLIBC_PREREQ
-#define __GLIBC_PREREQ(x, y) 0
-#endif
-
#if SANITIZER_LINUX && (__ANDROID_API__ >= 21 || __GLIBC_PREREQ (2, 14))
CHECK_TYPE_SIZE(mmsghdr);
CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h?rev=373632&r1=373631&r2=373632&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.h Thu Oct 3 10:46:07 2019
@@ -19,12 +19,13 @@
#include "sanitizer_internal_defs.h"
#include "sanitizer_platform.h"
-# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
-
-#ifndef __GLIBC_PREREQ
-#define __GLIBC_PREREQ(x, y) 0
+#if defined(__sparc__)
+// FIXME: This can't be included from tsan which does not support sparc yet.
+#include "sanitizer_glibc_version.h"
#endif
+# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
+
namespace __sanitizer {
extern unsigned struct_utsname_sz;
extern unsigned struct_stat_sz;
More information about the llvm-commits
mailing list