summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-07-05 09:23:37 +0000
committerDmitry Vyukov <dvyukov@google.com>2012-07-05 09:23:37 +0000
commit5dc3f016769d4d847298fce408149ff85032a501 (patch)
treee3747d1872aeaca99dc54832095347f1b08ecf55 /compiler-rt
parentba235522e05cd15a7d237ae0b2c88b83c9c6fce8 (diff)
downloadbcm5719-llvm-5dc3f016769d4d847298fce408149ff85032a501.tar.gz
bcm5719-llvm-5dc3f016769d4d847298fce408149ff85032a501.zip
tsan/asan: kill STL
First, placement new from standard library conflicts with our own. Second, we are in trouble if user uses the same function (we either get instrumented code in runtime, or non-instrumented code in user program). llvm-svn: 159738
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_common.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc
index a2c3c3fbe0b..b3e16b43bf5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc
@@ -13,10 +13,7 @@
#include "sanitizer_common.h"
#include "sanitizer_libc.h"
-
-// Should not add dependency on libstdc++,
-// since most of the stuff here is inlinable.
-#include <algorithm>
+#include <stdlib.h>
namespace __sanitizer {
@@ -60,8 +57,19 @@ uptr ReadFileToBuffer(const char *file_name, char **buff,
return read_len;
}
+static int comp(const void *p1, const void *p2) {
+ uptr v1 = *(uptr*)p1;
+ uptr v2 = *(uptr*)p2;
+ if (v1 < v2)
+ return -1;
+ else if (v1 > v2)
+ return 1;
+ else
+ return 0;
+}
+
void SortArray(uptr *array, uptr size) {
- std::sort(array, array + size);
+ qsort(array, size, sizeof(array[0]), &comp);
}
} // namespace __sanitizer
OpenPOWER on IntegriCloud