[PATCH 3/3] libsanitizer: add LFS guards
Bernhard Reutner-Fischer
rep.dot.nop@gmail.com
Fri Apr 5 00:25:00 GMT 2013
uClibc can be built without Largefile support, add the corresponding
guards. uClibc does not have __libc_malloc()/__libc_free(), add guard.
libsanitizer/ChangeLog
2013-03-24 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
* sanitizer_common/sanitizer_allocator.cc (libc_malloc,
libc_free): Guard with !uClibc.
* interception/interception_type_test.cc <OFF64_T>: add LFS guard.
* sanitizer_common/sanitizer_platform_limits_posix.cc
<struct_stat64_sz, struct_rlimit64_sz, struct_statfs64_sz>: Likewise.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
libsanitizer/interception/interception_type_test.cc | 2 +-
libsanitizer/sanitizer_common/sanitizer_allocator.cc | 4 +++-
libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/libsanitizer/interception/interception_type_test.cc b/libsanitizer/interception/interception_type_test.cc
index f664eee..91fab63 100644
--- a/libsanitizer/interception/interception_type_test.cc
+++ b/libsanitizer/interception/interception_type_test.cc
@@ -22,7 +22,7 @@ COMPILER_CHECK(sizeof(SSIZE_T) == sizeof(ssize_t));
COMPILER_CHECK(sizeof(PTRDIFF_T) == sizeof(ptrdiff_t));
COMPILER_CHECK(sizeof(INTMAX_T) == sizeof(intmax_t));
-#ifndef __APPLE__
+#if !defined __APPLE__ && (defined __USE_LARGEFILE64 && defined __off64_t_defined)
COMPILER_CHECK(sizeof(OFF64_T) == sizeof(off64_t));
#endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_allocator.cc b/libsanitizer/sanitizer_common/sanitizer_allocator.cc
index a54de9d..e17cf22 100644
--- a/libsanitizer/sanitizer_common/sanitizer_allocator.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_allocator.cc
@@ -9,11 +9,13 @@
// run-time libraries.
// This allocator that is used inside run-times.
//===----------------------------------------------------------------------===//
+
+#include <features.h>
#include "sanitizer_common.h"
// FIXME: We should probably use more low-level allocator that would
// mmap some pages and split them into chunks to fulfill requests.
-#if defined(__linux__) && !defined(__ANDROID__)
+#if defined(__linux__) && !defined(__ANDROID__) && !defined __UCLIBC__
extern "C" void *__libc_malloc(__sanitizer::uptr size);
extern "C" void __libc_free(void *ptr);
# define LIBC_MALLOC __libc_malloc
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index c4be1aa..c5e8f19 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -32,7 +32,9 @@
namespace __sanitizer {
unsigned struct_utsname_sz = sizeof(struct utsname);
unsigned struct_stat_sz = sizeof(struct stat);
+#ifdef __USE_LARGEFILE64
unsigned struct_stat64_sz = sizeof(struct stat64);
+#endif
unsigned struct_rusage_sz = sizeof(struct rusage);
unsigned struct_tm_sz = sizeof(struct tm);
@@ -43,7 +45,7 @@ namespace __sanitizer {
unsigned struct_epoll_event_sz = sizeof(struct epoll_event);
#endif // __linux__
-#if defined(__linux__) && !defined(__ANDROID__)
+#if defined(__linux__) && !defined(__ANDROID__) && defined __USE_LARGEFILE64
unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
unsigned struct_statfs64_sz = sizeof(struct statfs64);
#endif // __linux__ && !__ANDROID__
--
1.7.10.4
More information about the Gcc-patches
mailing list