summaryrefslogtreecommitdiffstats
path: root/llvm/tools/bugpoint/bugpoint.cpp
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2017-09-01 01:47:34 +0000
committerVitaly Buka <vitalybuka@google.com>2017-09-01 01:47:34 +0000
commit7c89b4b6329a7622d5b2f850122e6f41e8c5e137 (patch)
treec3e96a9bbeb75e2882806801f9875ed1c56f4894 /llvm/tools/bugpoint/bugpoint.cpp
parent3c84b579efb51b896cbdb93292b0674dc879c5b1 (diff)
downloadbcm5719-llvm-7c89b4b6329a7622d5b2f850122e6f41e8c5e137.tar.gz
bcm5719-llvm-7c89b4b6329a7622d5b2f850122e6f41e8c5e137.zip
Fix check-llvm on kernel 4.9+ with asan or msan
Summary: Before https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=v4.9.46&id=84638335900f1995495838fe1bd4870c43ec1f67 test worked because memory allocated with mmap was not counted against RLIMIT_DATA. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37366 llvm-svn: 312303
Diffstat (limited to 'llvm/tools/bugpoint/bugpoint.cpp')
-rw-r--r--llvm/tools/bugpoint/bugpoint.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp
index 4ddea8dbec1..ec1ca2e5496 100644
--- a/llvm/tools/bugpoint/bugpoint.cpp
+++ b/llvm/tools/bugpoint/bugpoint.cpp
@@ -50,10 +50,10 @@ static cl::opt<unsigned> TimeoutValue(
cl::desc("Number of seconds program is allowed to run before it "
"is killed (default is 300s), 0 disables timeout"));
-static cl::opt<int>
- MemoryLimit("mlimit", cl::init(-1), cl::value_desc("MBytes"),
- cl::desc("Maximum amount of memory to use. 0 disables check."
- " Defaults to 400MB (800MB under valgrind)."));
+static cl::opt<int> MemoryLimit(
+ "mlimit", cl::init(-1), cl::value_desc("MBytes"),
+ cl::desc("Maximum amount of memory to use. 0 disables check. Defaults to "
+ "400MB (800MB under valgrind, 0 with sanitizers)."));
static cl::opt<bool>
UseValgrind("enable-valgrind",
@@ -169,6 +169,12 @@ int main(int argc, char **argv) {
MemoryLimit = 800;
else
MemoryLimit = 400;
+#if (LLVM_ADDRESS_SANITIZER_BUILD || LLVM_MEMORY_SANITIZER_BUILD || \
+ LLVM_THREAD_SANITIZER_BUILD)
+ // Starting from kernel 4.9 memory allocated with mmap is counted against
+ // RLIMIT_DATA. Sanitizers need to allocate tens of terabytes for shadow.
+ MemoryLimit = 0;
+#endif
}
BugDriver D(argv[0], FindBugs, TimeoutValue, MemoryLimit, UseValgrind,
OpenPOWER on IntegriCloud