summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2011-12-01 21:40:52 +0000
committerKostya Serebryany <kcc@google.com>2011-12-01 21:40:52 +0000
commit5dfa4da0b92a7587d79ea17524cf25969d2353e1 (patch)
tree9b9623e8d82ed1fe7db9f740a307216e51916b82
parente6de63dfc5b7100bfb4a67412ba64db055dc2fbe (diff)
downloadbcm5719-llvm-5dfa4da0b92a7587d79ea17524cf25969d2353e1.tar.gz
bcm5719-llvm-5dfa4da0b92a7587d79ea17524cf25969d2353e1.zip
[asan] flatten the asan-rt build slightly
llvm-svn: 145631
-rw-r--r--compiler-rt/lib/asan/Makefile.old27
-rw-r--r--compiler-rt/lib/asan/asan_internal.h4
-rw-r--r--compiler-rt/lib/asan/asan_linux.cc3
-rw-r--r--compiler-rt/lib/asan/asan_mac.cc6
-rw-r--r--compiler-rt/lib/asan/asan_mac.h4
-rw-r--r--compiler-rt/lib/asan/asan_malloc_linux.cc3
-rw-r--r--compiler-rt/lib/asan/asan_malloc_mac.cc4
-rw-r--r--compiler-rt/lib/asan/asan_rtl.cc2
-rw-r--r--compiler-rt/lib/asan/mach_override/mach_override.c4
-rw-r--r--compiler-rt/lib/asan/mach_override/mach_override.h4
10 files changed, 39 insertions, 22 deletions
diff --git a/compiler-rt/lib/asan/Makefile.old b/compiler-rt/lib/asan/Makefile.old
index c796ae8b41c..7c2a7be6514 100644
--- a/compiler-rt/lib/asan/Makefile.old
+++ b/compiler-rt/lib/asan/Makefile.old
@@ -7,7 +7,6 @@
#
#===------------------------------------------------------------------------===#
-SVNVERSION=$(shell svnversion)
OS=$(shell uname | tr '[A-Z]' '[a-z]')
ROOT=$(shell pwd)
MAKEFILE=Makefile.old # this file.
@@ -169,44 +168,38 @@ ifeq ($(ASAN_COMPILER), gcc)
ASAN_LD_TAIL=$(LIBASAN_A)
endif
-RTL_HDR_COMMON=asan_allocator.h \
+RTL_HDR=asan_allocator.h \
asan_internal.h \
asan_interceptors.h \
asan_interface.h \
asan_lock.h \
+ asan_mac.h \
asan_mapping.h \
asan_stack.h \
asan_stats.h \
asan_thread.h \
asan_thread_registry.h \
+ mach_override/mach_override.h \
sysinfo/basictypes.h \
sysinfo/sysinfo.h
-LIBASAN_OBJ_COMMON=$(BIN)/asan_rtl$(SUFF).o \
+LIBASAN_OBJ=$(BIN)/asan_rtl$(SUFF).o \
$(BIN)/asan_allocator$(SUFF).o \
$(BIN)/asan_globals$(SUFF).o \
$(BIN)/asan_interceptors$(SUFF).o \
+ $(BIN)/asan_linux$(SUFF).o \
+ $(BIN)/asan_mac$(SUFF).o \
+ $(BIN)/asan_malloc_linux$(SUFF).o \
+ $(BIN)/asan_malloc_mac$(SUFF).o \
$(BIN)/asan_poisoning$(SUFF).o \
$(BIN)/asan_printf$(SUFF).o \
$(BIN)/asan_stack$(SUFF).o \
$(BIN)/asan_stats$(SUFF).o \
$(BIN)/asan_thread$(SUFF).o \
$(BIN)/asan_thread_registry$(SUFF).o \
+ $(BIN)/mach_override/mach_override$(SUFF).o \
$(BIN)/sysinfo/sysinfo$(SUFF).o
-ifeq ($(OS),darwin)
-RTL_HDR=$(RTL_HDR_COMMON) mach_override/mach_override.h asan_mac.h
-LIBASAN_OBJ=$(LIBASAN_OBJ_COMMON) \
- $(BIN)/asan_mac$(SUFF).o \
- $(BIN)/asan_malloc_mac$(SUFF).o \
- $(BIN)/mach_override/mach_override$(SUFF).o
-else
-RTL_HDR=$(RTL_HDR_COMMON)
-LIBASAN_OBJ=$(LIBASAN_OBJ_COMMON) \
- $(BIN)/asan_linux$(SUFF).o \
- $(BIN)/asan_malloc_linux$(SUFF).o
-endif
-
GTEST_ROOT=third_party/googletest
GTEST_INCLUDE=-I$(GTEST_ROOT)/include
GTEST_MAKE_DIR=$(GTEST_ROOT)/make-$(OS)$(SUFF)
@@ -269,7 +262,6 @@ $(BIN)/%_test$(SUFF).o: tests/%_test.mm $(RTL_HDR) $(MAKEFILE)
$(BIN)/%$(SUFF).o: %.cc $(RTL_HDR) $(MAKEFILE)
$(CXX) $(PIE) $(CFLAGS) -fPIC -c -o $@ -g $< -Ithird_party \
- -DASAN_REVISION=\"$(SVNVERSION)\" \
-DASAN_USE_SYSINFO=1 \
-DASAN_NEEDS_SEGV=$(ASAN_NEEDS_SEGV) \
-DASAN_HAS_EXCEPTIONS=$(ASAN_HAS_EXCEPTIONS) \
@@ -278,7 +270,6 @@ $(BIN)/%$(SUFF).o: %.cc $(RTL_HDR) $(MAKEFILE)
$(BIN)/%$(SUFF).o: %.c $(RTL_HDR) $(MAKEFILE)
$(CC) $(PIE) $(CFLAGS) -fPIC -c -o $@ -g $< -Ithird_party \
- -DASAN_REVISION=\"$(SVNVERSION)\" \
-DASAN_USE_SYSINFO=1 \
$(ASAN_FLAGS)
diff --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h
index 2c643035e41..16d8e423033 100644
--- a/compiler-rt/lib/asan/asan_internal.h
+++ b/compiler-rt/lib/asan/asan_internal.h
@@ -14,6 +14,10 @@
#ifndef ASAN_INTERNAL_H
#define ASAN_INTERNAL_H
+#if !defined(__linux__) && !defined(__APPLE__)
+# error "This operating system is not supported by AddressSanitizer"
+#endif
+
#include <stdint.h> // for __WORDSIZE
#include <stdlib.h> // for size_t
#include <unistd.h> // for _exit
diff --git a/compiler-rt/lib/asan/asan_linux.cc b/compiler-rt/lib/asan/asan_linux.cc
index 752300b7e0f..ceb722bf9f8 100644
--- a/compiler-rt/lib/asan/asan_linux.cc
+++ b/compiler-rt/lib/asan/asan_linux.cc
@@ -11,6 +11,7 @@
//
// Linux-specific details.
//===----------------------------------------------------------------------===//
+#ifdef __linux__
#include "asan_internal.h"
@@ -46,3 +47,5 @@ ssize_t asan_write(int fd, const void *buf, size_t count) {
}
} // namespace __asan
+
+#endif // __linux__
diff --git a/compiler-rt/lib/asan/asan_mac.cc b/compiler-rt/lib/asan/asan_mac.cc
index c125eff3d8b..0084fb75955 100644
--- a/compiler-rt/lib/asan/asan_mac.cc
+++ b/compiler-rt/lib/asan/asan_mac.cc
@@ -12,9 +12,7 @@
// Mac-specific details.
//===----------------------------------------------------------------------===//
-#ifndef __APPLE__
-#error "This file should be used on Mac OS X only."
-#endif
+#ifdef __APPLE__
#include "asan_mac.h"
@@ -254,3 +252,5 @@ int WRAP(pthread_workqueue_additem_np)(pthread_workqueue_t workq,
return real_pthread_workqueue_additem_np(workq, wrap_workitem_func, asan_ctxt,
itemhandlep, gencountp);
}
+
+#endif // __APPLE__
diff --git a/compiler-rt/lib/asan/asan_mac.h b/compiler-rt/lib/asan/asan_mac.h
index f35fd7994b5..32739e766cc 100644
--- a/compiler-rt/lib/asan/asan_mac.h
+++ b/compiler-rt/lib/asan/asan_mac.h
@@ -11,6 +11,8 @@
//
// ASan-private header for asan_mac.cc
//===----------------------------------------------------------------------===//
+#ifdef __APPLE__
+
#ifndef ASAN_MAC_H
#define ASAN_MAC_H
@@ -81,3 +83,5 @@ int WRAP(pthread_workqueue_additem_np)(pthread_workqueue_t workq,
}
#endif // ASAN_MAC_H
+
+#endif // __APPLE__
diff --git a/compiler-rt/lib/asan/asan_malloc_linux.cc b/compiler-rt/lib/asan/asan_malloc_linux.cc
index 1b96714536c..9dbc7a127fc 100644
--- a/compiler-rt/lib/asan/asan_malloc_linux.cc
+++ b/compiler-rt/lib/asan/asan_malloc_linux.cc
@@ -13,6 +13,7 @@
// We simply define functions like malloc, free, realloc, etc.
// They will replace the corresponding libc functions automagically.
//===----------------------------------------------------------------------===//
+#ifdef __linux__
#include "asan_allocator.h"
#include "asan_interceptors.h"
@@ -137,3 +138,5 @@ void *pvalloc(size_t size) {
return asan_pvalloc(size, &stack);
}
} // extern "C"
+
+#endif // __linux__
diff --git a/compiler-rt/lib/asan/asan_malloc_mac.cc b/compiler-rt/lib/asan/asan_malloc_mac.cc
index 0f79d1f3ae7..3ef17eb8e00 100644
--- a/compiler-rt/lib/asan/asan_malloc_mac.cc
+++ b/compiler-rt/lib/asan/asan_malloc_mac.cc
@@ -12,6 +12,8 @@
// Mac-specific malloc interception.
//===----------------------------------------------------------------------===//
+#ifdef __APPLE__
+
#include <AvailabilityMacros.h>
#include <CoreFoundation/CFBase.h>
#include <malloc/malloc.h>
@@ -378,3 +380,5 @@ void ReplaceSystemMalloc() {
}
}
} // namespace __asan
+
+#endif // __APPLE__
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc
index bb9c7b1d62c..7fb3b92b0b0 100644
--- a/compiler-rt/lib/asan/asan_rtl.cc
+++ b/compiler-rt/lib/asan/asan_rtl.cc
@@ -753,6 +753,6 @@ void __asan_init() {
__asan_force_interface_symbols(); // no-op.
if (FLAG_v) {
- Report("AddressSanitizer r%s Init done ***\n", ASAN_REVISION);
+ Report("AddressSanitizer Init done\n");
}
}
diff --git a/compiler-rt/lib/asan/mach_override/mach_override.c b/compiler-rt/lib/asan/mach_override/mach_override.c
index c0342f49468..342fefc2724 100644
--- a/compiler-rt/lib/asan/mach_override/mach_override.c
+++ b/compiler-rt/lib/asan/mach_override/mach_override.c
@@ -5,6 +5,8 @@
***************************************************************************/
+#ifdef __APPLE__
+
#include "mach_override.h"
#include <mach-o/dyld.h>
@@ -769,3 +771,5 @@ void atomic_mov64(
}
#endif
#endif
+
+#endif // __APPLE__
diff --git a/compiler-rt/lib/asan/mach_override/mach_override.h b/compiler-rt/lib/asan/mach_override/mach_override.h
index 76fdb1bbdfc..f1aa617418e 100644
--- a/compiler-rt/lib/asan/mach_override/mach_override.h
+++ b/compiler-rt/lib/asan/mach_override/mach_override.h
@@ -42,6 +42,8 @@
***************************************************************************/
+#ifdef __APPLE__
+
#ifndef _mach_override_
#define _mach_override_
@@ -119,3 +121,5 @@ mach_override_ptr(
}
#endif
#endif // _mach_override_
+
+#endif // __APPLE__
OpenPOWER on IntegriCloud