Internalize AllocationBegin functions after D147005
authorFangrui Song <i@maskray.me>
Thu, 13 Apr 2023 17:28:58 +0000 (10:28 -0700)
committerFangrui Song <i@maskray.me>
Thu, 13 Apr 2023 17:28:58 +0000 (10:28 -0700)
Reviewed By: thurston

Differential Revision: https://reviews.llvm.org/D148195

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

index 2d6a5dd..19d7777 100644 (file)
@@ -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;
index 36346d1..3075b6d 100644 (file)
@@ -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);
index 6760100..d3cb5c8 100644 (file)
@@ -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;
index 8399427..ee7faca 100644 (file)
@@ -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);
index 49c0aad..1e0d05d 100644 (file)
@@ -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);
index 1013303..c32a029 100644 (file)
@@ -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);
index b548265..e5271cf 100644 (file)
@@ -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);