[compiler-rt] 8c63dc6 - Internalize AllocationBegin functions after D147005
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 10:29:04 PDT 2023
Author: Fangrui Song
Date: 2023-04-13T10:28:58-07:00
New Revision: 8c63dc6f6dc0f905acbcbf7f67c60af8d3cbe5a2
URL: https://github.com/llvm/llvm-project/commit/8c63dc6f6dc0f905acbcbf7f67c60af8d3cbe5a2
DIFF: https://github.com/llvm/llvm-project/commit/8c63dc6f6dc0f905acbcbf7f67c60af8d3cbe5a2.diff
LOG: Internalize AllocationBegin functions after D147005
Reviewed By: thurston
Differential Revision: https://reviews.llvm.org/D148195
Added:
Modified:
compiler-rt/lib/asan/asan_allocator.cpp
compiler-rt/lib/dfsan/dfsan_allocator.cpp
compiler-rt/lib/hwasan/hwasan_allocator.cpp
compiler-rt/lib/lsan/lsan_allocator.cpp
compiler-rt/lib/memprof/memprof_allocator.cpp
compiler-rt/lib/msan/msan_allocator.cpp
compiler-rt/lib/tsan/rtl/tsan_mman.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_allocator.cpp b/compiler-rt/lib/asan/asan_allocator.cpp
index 2d6a5dd334464..19d7777c40282 100644
--- a/compiler-rt/lib/asan/asan_allocator.cpp
+++ b/compiler-rt/lib/asan/asan_allocator.cpp
@@ -1164,7 +1164,7 @@ IgnoreObjectResult IgnoreObject(const void *p) {
// ---------------------- Interface ---------------- {{{1
using namespace __asan;
-const void *AllocationBegin(const void *p) {
+static const void *AllocationBegin(const void *p) {
AsanChunk *m = __asan::instance.GetAsanChunkByAddr((uptr)p);
if (!m)
return nullptr;
diff --git a/compiler-rt/lib/dfsan/dfsan_allocator.cpp b/compiler-rt/lib/dfsan/dfsan_allocator.cpp
index 36346d163d982..3075b6da1c115 100644
--- a/compiler-rt/lib/dfsan/dfsan_allocator.cpp
+++ b/compiler-rt/lib/dfsan/dfsan_allocator.cpp
@@ -174,7 +174,7 @@ void *DFsanCalloc(uptr nmemb, uptr size) {
return DFsanAllocate(nmemb * size, sizeof(u64), true /*zeroise*/);
}
-const void *AllocationBegin(const void *p) {
+static const void *AllocationBegin(const void *p) {
if (!p)
return nullptr;
void *beg = allocator.GetBlockBegin(p);
diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index 676010080e4d8..d3cb5c8457259 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -409,7 +409,7 @@ HwasanChunkView FindHeapChunkByAddress(uptr address) {
return HwasanChunkView(reinterpret_cast<uptr>(block), metadata);
}
-const void *AllocationBegin(const void *p) {
+static const void *AllocationBegin(const void *p) {
const void *untagged_ptr = UntagPtr(p);
if (!untagged_ptr)
return nullptr;
diff --git a/compiler-rt/lib/lsan/lsan_allocator.cpp b/compiler-rt/lib/lsan/lsan_allocator.cpp
index 8399427dfba42..ee7facac6ea79 100644
--- a/compiler-rt/lib/lsan/lsan_allocator.cpp
+++ b/compiler-rt/lib/lsan/lsan_allocator.cpp
@@ -145,7 +145,7 @@ void GetAllocatorCacheRange(uptr *begin, uptr *end) {
*end = *begin + sizeof(AllocatorCache);
}
-const void *GetMallocBegin(const void *p) {
+static const void *GetMallocBegin(const void *p) {
if (!p)
return nullptr;
void *beg = allocator.GetBlockBegin(p);
diff --git a/compiler-rt/lib/memprof/memprof_allocator.cpp b/compiler-rt/lib/memprof/memprof_allocator.cpp
index 49c0aad39cfbd..1e0d05d47a6f8 100644
--- a/compiler-rt/lib/memprof/memprof_allocator.cpp
+++ b/compiler-rt/lib/memprof/memprof_allocator.cpp
@@ -681,7 +681,7 @@ int memprof_posix_memalign(void **memptr, uptr alignment, uptr size,
return 0;
}
-const void *memprof_malloc_begin(const void *p) {
+static const void *memprof_malloc_begin(const void *p) {
u64 user_requested_size;
MemprofChunk *m =
instance.GetMemprofChunkByAddr((uptr)p, user_requested_size);
diff --git a/compiler-rt/lib/msan/msan_allocator.cpp b/compiler-rt/lib/msan/msan_allocator.cpp
index 1013303af6795..c32a0290b6b42 100644
--- a/compiler-rt/lib/msan/msan_allocator.cpp
+++ b/compiler-rt/lib/msan/msan_allocator.cpp
@@ -260,7 +260,7 @@ static void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr size) {
return MsanAllocate(stack, nmemb * size, sizeof(u64), true);
}
-const void *AllocationBegin(const void *p) {
+static const void *AllocationBegin(const void *p) {
if (!p)
return nullptr;
void *beg = allocator.GetBlockBegin(p);
diff --git a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
index b548265fe6833..e5271cf5697f0 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
@@ -352,7 +352,7 @@ void *user_pvalloc(ThreadState *thr, uptr pc, uptr sz) {
return SetErrnoOnNull(user_alloc_internal(thr, pc, sz, PageSize));
}
-const void *user_alloc_begin(const void *p) {
+static const void *user_alloc_begin(const void *p) {
if (p == nullptr || !IsAppMem((uptr)p))
return nullptr;
void *beg = allocator()->GetBlockBegin(p);
More information about the llvm-commits
mailing list