[compiler-rt] 2c3eb8d - [nsan] Remove mallopt from nsan_interceptors (#101055)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 15:20:22 PDT 2024


Author: Daniel Martinez
Date: 2024-07-29T15:20:18-07:00
New Revision: 2c3eb8db057b9d58acd4735999f0f5d5d8d55b0d

URL: https://github.com/llvm/llvm-project/commit/2c3eb8db057b9d58acd4735999f0f5d5d8d55b0d
DIFF: https://github.com/llvm/llvm-project/commit/2c3eb8db057b9d58acd4735999f0f5d5d8d55b0d.diff

LOG: [nsan] Remove mallopt from nsan_interceptors (#101055)

Fixes a build failure on 19.1.0-rc1 when building on linux with musl as
the libc

musl does not provide mallopt, whereas glibc does. mallopt has
portability issues with other libc implementations. Just remove the use.

Co-authored-by: Daniel Martinez <danielmartinez at cock.li>

Added: 
    

Modified: 
    compiler-rt/lib/nsan/nsan_interceptors.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/nsan/nsan_interceptors.cpp b/compiler-rt/lib/nsan/nsan_interceptors.cpp
index 544b44f53cc42..852524bd37332 100644
--- a/compiler-rt/lib/nsan/nsan_interceptors.cpp
+++ b/compiler-rt/lib/nsan/nsan_interceptors.cpp
@@ -21,10 +21,6 @@
 
 #include <wchar.h>
 
-#if SANITIZER_LINUX
-extern "C" int mallopt(int param, int value);
-#endif
-
 using namespace __sanitizer;
 using __nsan::nsan_init_is_running;
 using __nsan::nsan_initialized;
@@ -209,12 +205,6 @@ void __nsan::InitializeInterceptors() {
   static bool initialized = false;
   CHECK(!initialized);
 
-  // Instruct libc malloc to consume less memory.
-#if SANITIZER_LINUX
-  mallopt(1, 0);          // M_MXFAST
-  mallopt(-3, 32 * 1024); // M_MMAP_THRESHOLD
-#endif
-
   InitializeMallocInterceptors();
 
   INTERCEPT_FUNCTION(memset);


        


More information about the llvm-commits mailing list