aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThurston Dang <thurston@google.com>2024-05-21 12:41:36 -0700
committerGitHub <noreply@github.com>2024-05-21 12:41:36 -0700
commit57a507930b50c445140feb68bffe1c21af53319e (patch)
treeba3dd12e9a74a565949b67caf0e6289bb5cea1aa
parent337e633bb75640bb6e04eb874c7114dfac6fa754 (diff)
downloadllvm-57a507930b50c445140feb68bffe1c21af53319e.zip
llvm-57a507930b50c445140feb68bffe1c21af53319e.tar.gz
llvm-57a507930b50c445140feb68bffe1c21af53319e.tar.bz2
[msan] Increase kNumStackOriginDescrs constant (#92838)
This increases the constant size of kNumStackOriginDescrs to 4M (64GB of BSS across two arrays), which ought to be enough for anybody. This is the easier alternative suggested by eugenis@ in https://github.com/llvm/llvm-project/pull/92826.
-rw-r--r--compiler-rt/lib/msan/msan.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler-rt/lib/msan/msan.cpp b/compiler-rt/lib/msan/msan.cpp
index a2fc27d..7a15291 100644
--- a/compiler-rt/lib/msan/msan.cpp
+++ b/compiler-rt/lib/msan/msan.cpp
@@ -100,7 +100,11 @@ int msan_report_count = 0;
// Array of stack origins.
// FIXME: make it resizable.
-static const uptr kNumStackOriginDescrs = 1024 * 1024;
+// Although BSS memory doesn't cost anything until used, it is limited to 2GB
+// in some configurations (e.g., "relocation R_X86_64_PC32 out of range:
+// ... is not in [-2147483648, 2147483647]; references section '.bss'").
+// We use kNumStackOriginDescrs * (sizeof(char*) + sizeof(uptr)) == 64MB.
+static const uptr kNumStackOriginDescrs = 4 * 1024 * 1024;
static const char *StackOriginDescr[kNumStackOriginDescrs];
static uptr StackOriginPC[kNumStackOriginDescrs];
static atomic_uint32_t NumStackOriginDescrs;